From 92dc61f161939535c8984ef8a33b393a0e51dcdf Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 23 Aug 2023 16:36:13 +0200 Subject: [d3d11] Fix up UAV clears for A8_UNORM --- src/d3d11/d3d11_context.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 21468988..977a403e 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -406,15 +406,22 @@ namespace dxvk { VkClearValue clearValue; - // R11G11B10 is a special case since there's no corresponding - // integer format with the same bit layout. Use R32 instead. - if (uavFormat == VK_FORMAT_B10G11R11_UFLOAT_PACK32) { + if (uavDesc.Format == DXGI_FORMAT_R11G11B10_FLOAT) { + // R11G11B10 is a special case since there's no corresponding + // integer format with the same bit layout. Use R32 instead. clearValue.color.uint32[0] = ((Values[0] & 0x7FF) << 0) | ((Values[1] & 0x7FF) << 11) | ((Values[2] & 0x3FF) << 22); clearValue.color.uint32[1] = 0; clearValue.color.uint32[2] = 0; clearValue.color.uint32[3] = 0; + } else if (uavDesc.Format == DXGI_FORMAT_A8_UNORM) { + // We need to use R8_UINT to clear A8_UNORM images, + // so remap the alpha component to the red channel. + clearValue.color.uint32[0] = Values[3]; + clearValue.color.uint32[1] = 0; + clearValue.color.uint32[2] = 0; + clearValue.color.uint32[3] = 0; } else { clearValue.color.uint32[0] = Values[0]; clearValue.color.uint32[1] = Values[1]; -- cgit v1.2.3