[PATCH vkd3d 1/5] vkd3d: Disable depth/stencil tests for DXGI_FORMAT_UNKNOWN.

Józef Kucia joseph.kucia at gmail.com
Wed Nov 28 11:51:18 CST 2018


From: Józef Kucia <jkucia at codeweavers.com>

Needs more tests.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 libs/vkd3d/state.c |  7 ++++++-
 tests/d3d12.c      | 11 +++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 6f7373e996ef..66da08a9c417 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -1948,8 +1948,13 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
         rt_count = ARRAY_SIZE(graphics->attachments) - 1;
     }
 
+    if (desc->DSVFormat == DXGI_FORMAT_UNKNOWN
+            && (desc->DepthStencilState.DepthEnable || desc->DepthStencilState.StencilEnable))
+        FIXME("DSV format is DXGI_FORMAT_UNKNOWN, disabling depth/stencil tests.\n");
+
     graphics->rt_idx = 0;
-    if (desc->DepthStencilState.DepthEnable || desc->DepthStencilState.StencilEnable)
+    if (desc->DSVFormat != DXGI_FORMAT_UNKNOWN
+            && (desc->DepthStencilState.DepthEnable || desc->DepthStencilState.StencilEnable))
     {
         const D3D12_DEPTH_STENCIL_DESC *ds_desc = &desc->DepthStencilState;
         VkImageLayout depth_layout;
diff --git a/tests/d3d12.c b/tests/d3d12.c
index d0372454a8c3..42fb24cc73d2 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -2734,6 +2734,17 @@ static void test_create_graphics_pipeline_state(void)
             &IID_ID3D12PipelineState, (void **)&pipeline_state);
     ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
 
+    /* DSVFormat = DXGI_FORMAT_UNKNOWN */
+    memset(blend, 0, sizeof(*blend));
+    pso_desc.DSVFormat = DXGI_FORMAT_UNKNOWN;
+    pso_desc.DepthStencilState.DepthEnable = TRUE;
+    pso_desc.DepthStencilState.DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL;
+    pso_desc.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_LESS;
+    hr = ID3D12Device_CreateGraphicsPipelineState(device, &pso_desc,
+            &IID_ID3D12PipelineState, (void **)&pipeline_state);
+    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+    ID3D12PipelineState_Release(pipeline_state);
+
     refcount = ID3D12RootSignature_Release(root_signature);
     ok(!refcount, "ID3D12RootSignature has %u references left.\n", (unsigned int)refcount);
     refcount = ID3D12Device_Release(device);
-- 
2.18.1




More information about the wine-devel mailing list