You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
Remove redundant thread sync counter draw_pending
The functions that used it already use a threadsafe FIFO queue to communicate between threads and a sync to have the main thread wait for the render thread. Fixes #35718
This commit is contained in:
@@ -333,13 +333,10 @@ void RenderingServerDefault::_thread_exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RenderingServerDefault::_thread_draw(bool p_swap_buffers, double frame_step) {
|
void RenderingServerDefault::_thread_draw(bool p_swap_buffers, double frame_step) {
|
||||||
if (!draw_pending.decrement()) {
|
|
||||||
_draw(p_swap_buffers, frame_step);
|
_draw(p_swap_buffers, frame_step);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void RenderingServerDefault::_thread_flush() {
|
void RenderingServerDefault::_thread_flush() {
|
||||||
draw_pending.decrement();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingServerDefault::_thread_callback(void *_instance) {
|
void RenderingServerDefault::_thread_callback(void *_instance) {
|
||||||
@@ -370,7 +367,6 @@ void RenderingServerDefault::_thread_loop() {
|
|||||||
|
|
||||||
void RenderingServerDefault::sync() {
|
void RenderingServerDefault::sync() {
|
||||||
if (create_thread) {
|
if (create_thread) {
|
||||||
draw_pending.increment();
|
|
||||||
command_queue.push_and_sync(this, &RenderingServerDefault::_thread_flush);
|
command_queue.push_and_sync(this, &RenderingServerDefault::_thread_flush);
|
||||||
} else {
|
} else {
|
||||||
command_queue.flush_all(); //flush all pending from other threads
|
command_queue.flush_all(); //flush all pending from other threads
|
||||||
@@ -379,7 +375,6 @@ void RenderingServerDefault::sync() {
|
|||||||
|
|
||||||
void RenderingServerDefault::draw(bool p_swap_buffers, double frame_step) {
|
void RenderingServerDefault::draw(bool p_swap_buffers, double frame_step) {
|
||||||
if (create_thread) {
|
if (create_thread) {
|
||||||
draw_pending.increment();
|
|
||||||
command_queue.push(this, &RenderingServerDefault::_thread_draw, p_swap_buffers, frame_step);
|
command_queue.push(this, &RenderingServerDefault::_thread_draw, p_swap_buffers, frame_step);
|
||||||
} else {
|
} else {
|
||||||
_draw(p_swap_buffers, frame_step);
|
_draw(p_swap_buffers, frame_step);
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ class RenderingServerDefault : public RenderingServer {
|
|||||||
SafeFlag draw_thread_up;
|
SafeFlag draw_thread_up;
|
||||||
bool create_thread;
|
bool create_thread;
|
||||||
|
|
||||||
SafeNumeric<uint64_t> draw_pending;
|
|
||||||
void _thread_draw(bool p_swap_buffers, double frame_step);
|
void _thread_draw(bool p_swap_buffers, double frame_step);
|
||||||
void _thread_flush();
|
void _thread_flush();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user