vkd3d: Validate RTV format for inactive render targets in pipeline state desc.

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 2018-12-13 10:28:39 +01:00 committed by Alexandre Julliard
parent 46034d4069
commit 5bb045c8f9
2 changed files with 16 additions and 0 deletions

View File

@ -1945,6 +1945,15 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
memset(&input_signature, 0, sizeof(input_signature));
for (i = desc->NumRenderTargets; i < ARRAY_SIZE(desc->RTVFormats); ++i)
{
if (desc->RTVFormats[i] != DXGI_FORMAT_UNKNOWN)
{
WARN("Format must be set to DXGI_FORMAT_UNKNOWN for inactive render targets.\n");
return E_INVALIDARG;
}
}
if (!(root_signature = unsafe_impl_from_ID3D12RootSignature(desc->pRootSignature)))
{
WARN("Root signature is NULL.\n");

View File

@ -2491,6 +2491,13 @@ static void test_create_graphics_pipeline_state(void)
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
ID3D12PipelineState_Release(pipeline_state);
/* Inactive render targets formats must be set to DXGI_FORMAT_UNKNOWN. */
init_pipeline_state_desc(&pso_desc, root_signature, DXGI_FORMAT_R8G8B8A8_UNORM, NULL, NULL, NULL);
pso_desc.RTVFormats[1] = DXGI_FORMAT_R8G8B8A8_UNORM;
hr = ID3D12Device_CreateGraphicsPipelineState(device, &pso_desc,
&IID_ID3D12PipelineState, (void **)&pipeline_state);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
refcount = ID3D12RootSignature_Release(root_signature);
ok(!refcount, "ID3D12RootSignature has %u references left.\n", (unsigned int)refcount);
refcount = ID3D12Device_Release(device);