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@tu-dortmund.de>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Philip Rebohle 2019-11-25 17:35:40 +03:30 committed by Alexandre Julliard
parent 207ca12725
commit a204a681a1
2 changed files with 22 additions and 5 deletions

View File

@ -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, static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID3D12GraphicsCommandList1 *iface,
D3D12_GPU_DESCRIPTOR_HANDLE gpu_handle, D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle, ID3D12Resource *resource, 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) 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 (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); ERR("Unhandled format %#x.\n", view->format->dxgi_format);
return; return;

View File

@ -4839,11 +4839,11 @@ static void test_clear_unordered_access_view_buffer(void)
{0x100, 0, 0, 0}, 0, false, true}, {0x100, 0, 0, 0}, 0, false, true},
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE}, {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}, {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}, {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}, {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}, {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}, {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, {}, {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_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_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. */ /* Test float clears with formats. */
{DXGI_FORMAT_R16G16_UNORM, 1, 1, 0, 0, 1, 0, {}, {DXGI_FORMAT_R16G16_UNORM, 1, 1, 0, 0, 1, 0, {},
{0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff8000, true}, {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff8000, true},