You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
CommandQueueMT: Fix flush re-entrancy
This commit is contained in:
@@ -364,6 +364,12 @@ class CommandQueueMT {
|
|||||||
void _flush() {
|
void _flush() {
|
||||||
lock();
|
lock();
|
||||||
|
|
||||||
|
if (unlikely(flush_read_ptr)) {
|
||||||
|
// Re-entrant call.
|
||||||
|
unlock();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WorkerThreadPool::thread_enter_command_queue_mt_flush(this);
|
WorkerThreadPool::thread_enter_command_queue_mt_flush(this);
|
||||||
while (flush_read_ptr < command_mem.size()) {
|
while (flush_read_ptr < command_mem.size()) {
|
||||||
uint64_t size = *(uint64_t *)&command_mem[flush_read_ptr];
|
uint64_t size = *(uint64_t *)&command_mem[flush_read_ptr];
|
||||||
@@ -376,13 +382,6 @@ class CommandQueueMT {
|
|||||||
sync_sem->sem.post(); // Release in case it needs sync/ret.
|
sync_sem->sem.post(); // Release in case it needs sync/ret.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(flush_read_ptr == 0)) {
|
|
||||||
// A reentrant call flushed.
|
|
||||||
DEV_ASSERT(command_mem.is_empty());
|
|
||||||
unlock();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
flush_read_ptr += size;
|
flush_read_ptr += size;
|
||||||
}
|
}
|
||||||
WorkerThreadPool::thread_exit_command_queue_mt_flush();
|
WorkerThreadPool::thread_exit_command_queue_mt_flush();
|
||||||
|
|||||||
Reference in New Issue
Block a user