Philip Rebohle : vkd3d: Handle DXGI_FORMAT_R11G11B10_FLOAT in d3d12_command_list_ClearUnorderedAccessViewUint().
Alexandre Julliard
julliard at winehq.org
Mon Nov 25 09:20:52 CST 2019
Module: vkd3d
Branch: master
Commit: a204a681a1878bee29cc7094b9265ac45d3ad949
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=a204a681a1878bee29cc7094b9265ac45d3ad949
Author: Philip Rebohle <philip.rebohle at tu-dortmund.de>
Date: Mon Nov 25 17:53:40 2019 +0330
vkd3d: Handle DXGI_FORMAT_R11G11B10_FLOAT in d3d12_command_list_ClearUnorderedAccessViewUint().
There is no bit-compatible UINT format, so we'll use DXGI_FORMAT_R32_UINT.
Signed-off-by: Philip Rebohle <philip.rebohle at tu-dortmund.de>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d/command.c | 19 ++++++++++++++++++-
tests/d3d12.c | 8 ++++----
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index e3810e2..75af27d 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -4979,6 +4979,22 @@ static void d3d12_command_list_clear_uav(struct d3d12_command_list *list,
}
}
+static const struct vkd3d_format *vkd3d_fixup_clear_uav_uint_colour(struct d3d12_device *device,
+ DXGI_FORMAT dxgi_format, VkClearColorValue *colour)
+{
+ switch (dxgi_format)
+ {
+ case DXGI_FORMAT_R11G11B10_FLOAT:
+ colour->uint32[0] = (colour->uint32[0] & 0x7ff)
+ | ((colour->uint32[1] & 0x7ff) << 11)
+ | ((colour->uint32[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)
@@ -5000,7 +5016,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID
if (view->format->type != VKD3D_FORMAT_TYPE_UINT)
{
- if (!(uint_format = vkd3d_find_uint_format(device, view->format->dxgi_format)))
+ if (!(uint_format = vkd3d_find_uint_format(device, view->format->dxgi_format))
+ && !(uint_format = vkd3d_fixup_clear_uav_uint_colour(device, view->format->dxgi_format, &colour)))
{
ERR("Unhandled format %#x.\n", view->format->dxgi_format);
return;
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 5d549e2..52de007 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -4839,11 +4839,11 @@ static void test_clear_unordered_access_view_buffer(void)
{0x100, 0, 0, 0}, 0, false, true},
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0, 0, 0, 0}, 0, false, true},
+ {0, 0, 0, 0}, 0},
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0x7ff, 0x7ff, 0x3ff, 0}, 0xffffffff, false, true},
+ {0x7ff, 0x7ff, 0x3ff, 0}, 0xffffffff},
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0x7ff, 0, 0x3ff, 0}, 0xffc007ff, false, true},
+ {0x7ff, 0, 0x3ff, 0}, 0xffc007ff},
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0x40000000 /* 2.0f */, 0}, 0x801e0380, true},
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
@@ -5011,7 +5011,7 @@ static void test_clear_unordered_access_view_image(void)
{DXGI_FORMAT_R8G8B8A8_UINT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x04030201},
{DXGI_FORMAT_R8G8B8A8_UINT, 1, 1, 0, 0, 1, 0, {}, {0x123, 0, 0, 0}, 0x00000023, false, true},
{DXGI_FORMAT_R8G8B8A8_UNORM, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x04030201},
- {DXGI_FORMAT_R11G11B10_FLOAT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00c01001, false, true},
+ {DXGI_FORMAT_R11G11B10_FLOAT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00c01001},
/* Test float clears with formats. */
{DXGI_FORMAT_R16G16_UNORM, 1, 1, 0, 0, 1, 0, {},
{0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff8000, true},
More information about the wine-cvs
mailing list