From e23792ef91cd80a823f4d91b9c4680445092f4c9 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 7 Jul 2021 15:55:27 +0200 Subject: [PATCH] [d3d11] Fix handling sRGB UAV images --- src/d3d11/d3d11_texture.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/d3d11/d3d11_texture.cpp b/src/d3d11/d3d11_texture.cpp index 7f17a2e7..9faaae6e 100644 --- a/src/d3d11/d3d11_texture.cpp +++ b/src/d3d11/d3d11_texture.cpp @@ -74,12 +74,6 @@ namespace dxvk { } } - // Some games will try to create an SRGB image with the UAV - // bind flag set. This works on Windows, but no UAVs can be - // created for the image in practice. - bool noUav = formatProperties->flags.test(DxvkFormatFlag::ColorSpaceSrgb) - && !CheckFormatFeatureSupport(formatInfo.Format, VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT); - // Adjust image flags based on the corresponding D3D flags if (m_desc.BindFlags & D3D11_BIND_SHADER_RESOURCE) { imageInfo.usage |= VK_IMAGE_USAGE_SAMPLED_BIT; @@ -102,11 +96,16 @@ namespace dxvk { | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; } - if (m_desc.BindFlags & D3D11_BIND_UNORDERED_ACCESS && !noUav) { + if (m_desc.BindFlags & D3D11_BIND_UNORDERED_ACCESS) { imageInfo.usage |= VK_IMAGE_USAGE_STORAGE_BIT; imageInfo.stages |= pDevice->GetEnabledShaderStages(); imageInfo.access |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; + + // UAVs are not supported for sRGB formats on most drivers, + // but we can still create linear views for the image + if (formatProperties->flags.test(DxvkFormatFlag::ColorSpaceSrgb)) + imageInfo.flags |= VK_IMAGE_CREATE_EXTENDED_USAGE_BIT; } // Multi-plane formats need views to be created with color formats, and