1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-27 15:57:02 +00:00

CommandQueueMT: Optimize & fix handling of sync/ret commands

This commit is contained in:
Pedro J. Estébanez
2024-04-16 17:45:56 +02:00
parent 7abe0c6014
commit 15de869a9c
2 changed files with 30 additions and 72 deletions

View File

@@ -41,35 +41,6 @@ void CommandQueueMT::unlock() {
mutex.unlock();
}
void CommandQueueMT::wait_for_flush() {
// wait one millisecond for a flush to happen
OS::get_singleton()->delay_usec(1000);
}
CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() {
int idx = -1;
while (true) {
lock();
for (int i = 0; i < SYNC_SEMAPHORES; i++) {
if (!sync_sems[i].in_use) {
sync_sems[i].in_use = true;
idx = i;
break;
}
}
unlock();
if (idx == -1) {
wait_for_flush();
} else {
break;
}
}
return &sync_sems[idx];
}
CommandQueueMT::CommandQueueMT() {
}