[PATCH vkd3d 11/13] vkd3d: Handle R11G11B10_FLOAT in ClearUnorderedAccessViewUint.

Philip Rebohle philip.rebohle at tu-dortmund.de
Mon Nov 11 10:03:46 CST 2019


There is no bit-compatible UINT format, so we'll use R32_UINT.

Signed-off-by: Philip Rebohle <philip.rebohle at tu-dortmund.de>
---
 libs/vkd3d/command.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index e5fe0ad..0745cfc 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -4925,6 +4925,22 @@ static void d3d12_command_list_clear_unordered_access_view(struct d3d12_command_
     }
 }
 
+static const struct vkd3d_format *vkd3d_fixup_clear_uav_uint_color(struct d3d12_device *device,
+        DXGI_FORMAT dxgi_format, const UINT values[4], VkClearColorValue *color)
+{
+    switch (dxgi_format)
+    {
+        case DXGI_FORMAT_R11G11B10_FLOAT:
+            color->uint32[0] = (values[0] & 0x7FF)
+                    | ((values[1] & 0x7FF) << 11)
+                    | ((values[2] & 0x3FF) << 22);
+            return vkd3d_get_format(device, DXGI_FORMAT_R32_UINT, false);
+
+        default:
+            return NULL;
+    }
+}
+
 static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID3D12GraphicsCommandList1 *iface,
         D3D12_GPU_DESCRIPTOR_HANDLE gpu_handle, D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle, ID3D12Resource *resource,
         const UINT values[4], UINT rect_count, const D3D12_RECT *rects)
@@ -4950,7 +4966,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID
     {
         uint_format = vkd3d_find_uint_format(list->device, base_view->format->dxgi_format);
 
-        if (!uint_format)
+        if (!uint_format && !(uint_format = vkd3d_fixup_clear_uav_uint_color(
+                list->device, base_view->format->dxgi_format, values, &color)))
         {
             ERR("Unhandled format %d.\n", base_view->format->dxgi_format);
             return;
-- 
2.24.0




More information about the wine-devel mailing list