Repository navigation
D3D12: An sRGB Texture Keeps the Compression of Its Linear Twin - #475
Merged
Merged
Conversation
An unordered access view is never sRGB, so a uint clear writes an sRGB texture through its linear twin's format: judge the format view it needs as the twin's. Aliased in a heap, the two then agree on compression, which Metal needs to show one's contents through the other.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A texture placed over its sRGB twin in a heap now reads what the twin drew, as it did before textures kept their lossless compression.
An sRGB texture that allows unordered access was made with Metal's pixel format view usage for uint clears, which its linear twin was not, so only the linear one kept its compression. No unordered access view is sRGB, so a uint clear always writes such a texture through a linear view, and the sRGB texture never needed the usage. Metal shows one texture's writes through another placed over the same memory only where the two agree on that usage: with it on one of them, nearly every texel reads wrong. D3D12 only promises shared contents for identical descriptions, but games rely on this pair, and vkd3d-proton's test_srgb_unorm_mismatch_usage_aliasing (from Assassin's Creed Shadows) covers it. That test passes again.
d3d12_alias_srgb draws through each twin of R8G8B8A8 and B8G8R8A8 and reads through the other, with unordered access on either twin, both or neither. It passes on native, 9, 8, 7 and their Metal 3 runs, and its fault patch is caught.
Related to #359.