You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
CommandQueueMT doesn't lock during command execution
This commit is contained in:
@@ -76,6 +76,30 @@ CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() {
|
||||
return &sync_sems[idx];
|
||||
}
|
||||
|
||||
bool CommandQueueMT::dealloc_one() {
|
||||
tryagain:
|
||||
if (dealloc_ptr == write_ptr) {
|
||||
// The queue is empty
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t size = *(uint32_t *)&command_mem[dealloc_ptr];
|
||||
|
||||
if (size == 0) {
|
||||
// End of command buffer wrap down
|
||||
dealloc_ptr = 0;
|
||||
goto tryagain;
|
||||
}
|
||||
|
||||
if (size & 1) {
|
||||
// Still used, nothing can be deallocated
|
||||
return false;
|
||||
}
|
||||
|
||||
dealloc_ptr += (size >> 1) + sizeof(uint32_t);
|
||||
return true;
|
||||
}
|
||||
|
||||
CommandQueueMT::CommandQueueMT(bool p_sync) {
|
||||
|
||||
read_ptr = 0;
|
||||
|
||||
Reference in New Issue
Block a user