[Graphics] Dx11: Fix ResizeBuffer when swap chain is under flip model and changing format #1814
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.
PR Details
Why this issue occurred:
Flip model supports 3 different formats, none of them are sRGB.
The asset view swaps between gamma and linear rendering depending on the asset, so non-sRGB and sRGB format.
When the swap chain is initialized, the logic stripped out the sRGB specifier from the format provided, so it never could crash then.
But when the view changes size or format, ResizeBuffer is called, if the format requested is sRGB it won't be stripped out, so it'll silently crash the application.
What this PR does:
Ensures that the format, when creating and on resize, is not only non-sRGB but also supported by flip model.
This seems a bit weird for me though, should we not require the callers to provide a format that is compatible with the flip model if they do enable it, instead of silently fixing the format for them ? I can understand doing so if there are no difference in visuals but that seems unlikely ? Maybe you could chime in @azeno ?
Related Issue
Fixes #1770
Related to PR #1594
Types of changes
Checklist