vkd3d: Skip uninitialized descriptors in OMSetRenderTargets().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-01-18 10:25:45 +01:00 committed by Alexandre Julliard
parent 4c0692b2ef
commit e37cb78a22
2 changed files with 40 additions and 2 deletions

View File

@ -3749,7 +3749,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_OMSetRenderTargets(ID3D12Graphi
rtv_desc = d3d12_rtv_desc_from_cpu_handle(render_target_descriptors[i]);
}
if (!rtv_desc)
if (!rtv_desc || !rtv_desc->resource)
{
WARN("RTV descriptor %u is not initialized.\n", i);
list->views[i + 1] = VK_NULL_HANDLE;
@ -3773,7 +3773,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_OMSetRenderTargets(ID3D12Graphi
if (depth_stencil_descriptor)
{
if ((dsv_desc = d3d12_dsv_desc_from_cpu_handle(*depth_stencil_descriptor)))
if ((dsv_desc = d3d12_dsv_desc_from_cpu_handle(*depth_stencil_descriptor))
&& dsv_desc->resource)
{
d3d12_command_list_track_resource_usage(list, dsv_desc->resource);

View File

@ -4219,6 +4219,42 @@ static void test_clear_unordered_access_view(void)
#undef BUFFER_SIZE
}
static void test_set_render_targets(void)
{
ID3D12DescriptorHeap *dsv_heap, *rtv_heap;
ID3D12GraphicsCommandList *command_list;
D3D12_CPU_DESCRIPTOR_HANDLE dsv, rtv;
struct test_context context;
ID3D12Device *device;
HRESULT hr;
if (!init_test_context(&context, NULL))
return;
device = context.device;
command_list = context.list;
rtv_heap = create_cpu_descriptor_heap(device, D3D12_DESCRIPTOR_HEAP_TYPE_RTV, 4);
dsv_heap = create_cpu_descriptor_heap(device, D3D12_DESCRIPTOR_HEAP_TYPE_DSV, 4);
dsv = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(dsv_heap);
rtv = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(rtv_heap);
ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &rtv, FALSE, NULL);
ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &rtv, TRUE, NULL);
ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &rtv, TRUE, &dsv);
ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 0, &rtv, TRUE, &dsv);
ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 0, &rtv, FALSE, &dsv);
ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 0, NULL, TRUE, &dsv);
ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 0, NULL, FALSE, &dsv);
hr = ID3D12GraphicsCommandList_Close(command_list);
ok(hr == S_OK, "Failed to close command list, hr %#x.\n", hr);
ID3D12DescriptorHeap_Release(rtv_heap);
ID3D12DescriptorHeap_Release(dsv_heap);
destroy_test_context(&context);
}
static void test_draw_instanced(void)
{
static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f};
@ -22893,6 +22929,7 @@ START_TEST(d3d12)
run_test(test_clear_depth_stencil_view);
run_test(test_clear_render_target_view);
run_test(test_clear_unordered_access_view);
run_test(test_set_render_targets);
run_test(test_draw_instanced);
run_test(test_draw_indexed_instanced);
run_test(test_draw_no_descriptor_bindings);