[PATCH vkd3d 2/5] vkd3d: Allow depth rendering without pixel shader.

Józef Kucia joseph.kucia at gmail.com
Thu Nov 15 09:32:38 CST 2018


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

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 libs/vkd3d/state.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 35b900016256..bf4eee9813ee 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -1893,6 +1893,17 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
     HRESULT hr;
     int ret;
 
+    static const DWORD default_ps_code[] =
+    {
+#if 0
+        ps_4_0
+        ret
+#endif
+        0x43425844, 0x19cbf606, 0x18f562b9, 0xdaeed4db, 0xc324aa46, 0x00000001, 0x00000060, 0x00000003,
+        0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+        0x00000008, 0x00000000, 0x00000008, 0x52444853, 0x0000000c, 0x00000040, 0x00000003, 0x0100003e,
+    };
+    static const D3D12_SHADER_BYTECODE default_ps = {default_ps_code, sizeof(default_ps_code)};
     static const struct
     {
         enum VkShaderStageFlagBits stage;
@@ -1984,6 +1995,15 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
         graphics->attachment_references[0].attachment = 0;
         graphics->attachment_references[0].layout = depth_layout;
         ++graphics->rt_idx;
+
+        if (!desc->PS.pShaderBytecode)
+        {
+            if (FAILED(hr = create_shader_stage(device, &graphics->stages[graphics->stage_count],
+                    VK_SHADER_STAGE_FRAGMENT_BIT, &default_ps, NULL, NULL)))
+                goto fail;
+
+            ++graphics->stage_count;
+        }
     }
 
     for (i = 0; i < rt_count; ++i)
-- 
2.18.1




More information about the wine-devel mailing list