Conor McCarthy : vkd3d: Pass shader extension info to all graphics stages.

Alexandre Julliard julliard at winehq.org
Mon Feb 7 15:55:38 CST 2022


Module: vkd3d
Branch: master
Commit: 3fe14928117bf5285dce3d97868dc522c21ee26c
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=3fe14928117bf5285dce3d97868dc522c21ee26c

Author: Conor McCarthy <cmccarthy at codeweavers.com>
Date:   Sat Feb  5 01:55:17 2022 +1000

vkd3d: Pass shader extension info to all graphics stages.

Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d/state.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 12c7a9e..ce00dfe 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -2450,13 +2450,14 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
     VkVertexInputBindingDivisorDescriptionEXT *binding_divisor;
     const struct vkd3d_vulkan_info *vk_info = &device->vk_info;
     uint32_t instance_divisors[D3D12_VS_INPUT_REGISTER_COUNT];
+    struct vkd3d_shader_spirv_target_info *stage_target_info;
     uint32_t aligned_offsets[D3D12_VS_INPUT_REGISTER_COUNT];
+    struct vkd3d_shader_descriptor_offset_info offset_info;
     struct vkd3d_shader_parameter ps_shader_parameters[1];
     struct vkd3d_shader_transform_feedback_info xfb_info;
     struct vkd3d_shader_spirv_target_info ps_target_info;
     struct vkd3d_shader_interface_info shader_interface;
-    struct vkd3d_shader_descriptor_offset_info offset_info;
-    struct vkd3d_shader_spirv_target_info *target_info;
+    struct vkd3d_shader_spirv_target_info target_info;
     const struct d3d12_root_signature *root_signature;
     struct vkd3d_shader_signature input_signature;
     bool have_attachment, is_dsv_format_unknown;
@@ -2661,6 +2662,12 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
         }
     }
 
+    memset(&target_info, 0, sizeof(target_info));
+    target_info.type = VKD3D_SHADER_STRUCTURE_TYPE_SPIRV_TARGET_INFO;
+    target_info.environment = VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_0;
+    target_info.extensions = vk_info->shader_extensions;
+    target_info.extension_count = vk_info->shader_extension_count;
+
     graphics->xfb_enabled = false;
     if (so_desc->NumEntries)
     {
@@ -2713,7 +2720,6 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
         offset_info.descriptor_table_count = 0;
         offset_info.binding_offsets = root_signature->descriptor_offsets;
         offset_info.uav_counter_offsets = NULL;
-        vkd3d_prepend_struct(&shader_interface, &offset_info);
     }
 
     for (i = 0; i < ARRAY_SIZE(shader_stages); ++i)
@@ -2745,7 +2751,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
 
         shader_interface.uav_counters = NULL;
         shader_interface.uav_counter_count = 0;
-        target_info = NULL;
+        stage_target_info = &target_info;
         switch (shader_stages[i].stage)
         {
             case VK_SHADER_STAGE_VERTEX_BIT:
@@ -2772,7 +2778,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
             case VK_SHADER_STAGE_FRAGMENT_BIT:
                 shader_interface.uav_counters = state->uav_counters.bindings;
                 shader_interface.uav_counter_count = state->uav_counters.binding_count;
-                target_info = &ps_target_info;
+                stage_target_info = &ps_target_info;
                 break;
 
             default:
@@ -2781,10 +2787,15 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
         }
 
         shader_interface.next = NULL;
+        xfb_info.next = NULL;
+        ps_target_info.next = NULL;
+        target_info.next = NULL;
+        offset_info.next = NULL;
         if (shader_stages[i].stage == xfb_stage)
             vkd3d_prepend_struct(&shader_interface, &xfb_info);
-        if (target_info)
-            vkd3d_prepend_struct(&shader_interface, target_info);
+        vkd3d_prepend_struct(&shader_interface, stage_target_info);
+        if (root_signature->descriptor_offsets)
+            vkd3d_prepend_struct(&shader_interface, &offset_info);
 
         if (FAILED(hr = create_shader_stage(device, &graphics->stages[graphics->stage_count],
                 shader_stages[i].stage, b, &shader_interface)))




More information about the wine-cvs mailing list