Skip to content

Commit

Permalink
Merge pull request #47232 from zmanuel/eliminate-draw-pending-3.x
Browse files Browse the repository at this point in the history
[3.x] Remove redundant thread sync counter draw_pending
  • Loading branch information
akien-mga authored Aug 6, 2022
2 parents 3b17447 + 9fbdace commit 7637b5d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
7 changes: 1 addition & 6 deletions servers/visual/visual_server_wrap_mt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@ void VisualServerWrapMT::thread_exit() {
}

void VisualServerWrapMT::thread_draw(bool p_swap_buffers, double frame_step) {
if (!draw_pending.decrement()) {
visual_server->draw(p_swap_buffers, frame_step);
}
visual_server->draw(p_swap_buffers, frame_step);
}

void VisualServerWrapMT::thread_flush() {
draw_pending.decrement();
}

void VisualServerWrapMT::_thread_callback(void *_instance) {
Expand Down Expand Up @@ -75,7 +72,6 @@ void VisualServerWrapMT::thread_loop() {

void VisualServerWrapMT::sync() {
if (create_thread) {
draw_pending.increment();
command_queue.push_and_sync(this, &VisualServerWrapMT::thread_flush);
} else {
command_queue.flush_all(); //flush all pending from other threads
Expand All @@ -84,7 +80,6 @@ void VisualServerWrapMT::sync() {

void VisualServerWrapMT::draw(bool p_swap_buffers, double frame_step) {
if (create_thread) {
draw_pending.increment();
command_queue.push(this, &VisualServerWrapMT::thread_draw, p_swap_buffers, frame_step);
} else {
visual_server->draw(p_swap_buffers, frame_step);
Expand Down
1 change: 0 additions & 1 deletion servers/visual/visual_server_wrap_mt.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class VisualServerWrapMT : public VisualServer {
SafeFlag draw_thread_up;
bool create_thread;

SafeNumeric<uint64_t> draw_pending;
void thread_draw(bool p_swap_buffers, double frame_step);
void thread_flush();

Expand Down

0 comments on commit 7637b5d

Please sign in to comment.