From 0cfa5b16d37398dfccfa6605216a2986d66830fc Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 10 Nov 2018 18:48:44 +0100 Subject: [PATCH] [d3d11] Support R11G11B10 format in ClearUnorderedAccessViewUint Silences an error message in Shadow of the Tomb Raider. Does not have any consequences for this game because it initializes the view to 0. --- src/d3d11/d3d11_context.cpp | 8 +++++++- src/dxgi/dxgi_format.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index c79d22dfd..1fa53d8df 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -686,7 +686,6 @@ namespace dxvk { VkFormat uavFormat = m_parent->LookupFormat(uavDesc.Format, DXGI_VK_FORMAT_MODE_ANY).Format; VkFormat rawFormat = m_parent->LookupFormat(uavDesc.Format, DXGI_VK_FORMAT_MODE_RAW).Format; - // FIXME support packed formats if (uavFormat != rawFormat && rawFormat == VK_FORMAT_UNDEFINED) { Logger::err(str::format("D3D11: ClearUnorderedAccessViewUint: No raw format found for ", uavFormat)); return; @@ -698,6 +697,13 @@ namespace dxvk { clearValue.color.uint32[1] = Values[1]; clearValue.color.uint32[2] = Values[2]; clearValue.color.uint32[3] = Values[3]; + + // This is the only packed format that has UAV support + if (uavFormat == VK_FORMAT_B10G11R11_UFLOAT_PACK32) { + clearValue.color.uint32[0] = ((Values[0] & 0x7FF) << 0) + | ((Values[1] & 0x7FF) << 11) + | ((Values[2] & 0x3FF) << 22); + } if (uav->GetResourceType() == D3D11_RESOURCE_DIMENSION_BUFFER) { // In case of raw and structured buffers as well as typed diff --git a/src/dxgi/dxgi_format.cpp b/src/dxgi/dxgi_format.cpp index b7af88de7..6c956e444 100644 --- a/src/dxgi/dxgi_format.cpp +++ b/src/dxgi/dxgi_format.cpp @@ -129,7 +129,7 @@ namespace dxvk { // DXGI_FORMAT_R11G11B10_FLOAT { VK_FORMAT_B10G11R11_UFLOAT_PACK32, VK_FORMAT_UNDEFINED, - VK_FORMAT_UNDEFINED, + VK_FORMAT_R32_UINT, VK_IMAGE_ASPECT_COLOR_BIT }, // DXGI_FORMAT_R8G8B8A8_TYPELESS { VK_FORMAT_R8G8B8A8_UNORM,