Fix DXGI present failures caused by race conditions #12
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.
In some scenarios (seen while loading or particularly high, uncapped framerate scenarios), resetting the command allocator before the previous command list had finished executing on the GPU would cause DXGI present to fail with DXGI_ERROR_DEVICE_HUNG or some other similar error, and the game would subsequently crash.
Seen 100% during loading screens with uncapped, variable framerate in Dragon's Dogma 2. This could've also happened sometimes when the backbuffer was resized (aka
on_device_reset
), then reframework-d2d would release all of its resources sometimes before the command lists using them were finished.This PR does the following things:
CommandContext.hpp/.cpp are slimmed down versions of the ones used in REFramework/UEVR/FF7R-UEVR.
This could arguably be much simpler if 1 fence was just used for the original command list/allocator, however this has the drawback of lowering performance in double/triple-buffered scenarios (as is common on D3D12 with multiple backbuffers)