diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2024-04-10 09:57:33 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2024-04-10 10:02:30 +0200 |
commit | 114b14b0fa2bc6dea0163bd1343a4dca3abb86a0 (patch) | |
tree | 93b677092249249942316e6dd2a28cc5768d38eb | |
parent | e5b4ef8e9522e950033cbece39a31a4a76da19c1 (diff) | |
download | redot-engine-114b14b0fa2bc6dea0163bd1343a4dca3abb86a0.tar.gz |
CommandQueueMT: Fix flush re-entrancy
-rw-r--r-- | core/templates/command_queue_mt.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/core/templates/command_queue_mt.h b/core/templates/command_queue_mt.h index 4056119851..e26f11d28a 100644 --- a/core/templates/command_queue_mt.h +++ b/core/templates/command_queue_mt.h @@ -364,6 +364,12 @@ class CommandQueueMT { void _flush() { lock(); + if (unlikely(flush_read_ptr)) { + // Re-entrant call. + unlock(); + return; + } + WorkerThreadPool::thread_enter_command_queue_mt_flush(this); while (flush_read_ptr < command_mem.size()) { 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. } - if (unlikely(flush_read_ptr == 0)) { - // A reentrant call flushed. - DEV_ASSERT(command_mem.is_empty()); - unlock(); - return; - } - flush_read_ptr += size; } WorkerThreadPool::thread_exit_command_queue_mt_flush(); |