Fix potential crash when resizing windows when using D3D12 graphics backend #829
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.
Fixed the crash described in #822
The issues basically boils down to this:
When the user resized the window at exactly the wrong time, the current commandbuffer that the GPU's processing is the commandbuffer that writes to the backbuffer at index 0.
When, at that time, the resize happens, the code sets
windows[current_window].currentBuffer = 0
insidekinc_g4_begin()
. this results in the commandqueue trying to write to the wrong backbuffer for the next frame (basically it would then try to write to backbuffer 0 again even though it expects to write to backbuffer 1 - if that makes sense).This requires further testing with an actual workload as I only tested this with the input test.
My testcode for this basically looked like this:
Before my change the crash would happen at some point preceeded by logspam that read like this: