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.
After previous wgpu optimizations I missed an import detail which could lead to wrong values being read when using client.create(), which in turn could cause crashes.
This happens when in one queue.submit() call multiple write_buffer_with to the same buffer were queued up. The intention is to say
write -> read -> write -> read
on a buffer, but that would be executed aswrite -> write -> read -> read
.Where things get really mysterious is that simply fixing that bug wasn't enough. If however I also prevent buffers being re-used for the NEXT queue submission, the issue really is resolved! This is not just due to timing - if I place a poll(WAIT) in between every submit the crash still happens. This is very fishy and needs to be investigated more, but sending this PR now so things are at least stable.
The bug was more likely to be hit with a high
tasks_max
. After this PR, even with tasks_max disabled all together and a manual flush after lots of commands runs fine.