[d3d11] Fix up UAV clears for A8_UNORM

This commit is contained in:
Philip Rebohle 2023-08-23 16:36:13 +02:00
parent 6a5ed02db3
commit 92dc61f161
1 changed files with 10 additions and 3 deletions

View File

@ -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];