Fix buffer updates going to the wrong cmd buffer if barriers were 0 #83736
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
From what I could see only SSAO & SSIL were affected when they both call:
Also documented what setup_command_buffer & draw_command_buffer are for.
I placed breakpoints to see who calls buffer_update() with barriers = 0 and those two were the only calls.
@DarioSamo found this bug while working on Acyclic Render Graphs, but asked me to look deeper into it as he is occupied with the ARG.
Fortunately it doesn't seem like the damage is large:
buffer_update
calls_buffer_update
with the wrong queue, buffer_update has the_THREAD_SAFE_METHOD_
macro_buffer_update
directly also use the_THREAD_SAFE_METHOD_
macro.So there are no race conditions on the CPU side.
As for the GPU side it's a little more horrible:
What Godot wanted to do:
What Godot ends up doing:
What most likely ends up happening most of the time:
With my fix, I had to add
BARRIER_MASK_TRANSFER
to compute_list_end so that the reset is guaranteed to happen after the compute work (though it could probably be moved far elsewhere, e.g. at the end of the frame).