=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: vkd3d-shader: Require shader signature elements for shader inputs.

Alexandre Julliard julliard at winehq.org
Tue Oct 30 12:38:26 CDT 2018


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Tue Oct 30 15:22:52 2018 +0100

vkd3d-shader: Require shader signature elements for shader inputs.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d-shader/spirv.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 4fc25ee..dee561a 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -3206,6 +3206,13 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
         reg_idx = reg->idx[0].offset;
     }
 
+    if (!(signature_element = vkd3d_find_signature_element_for_reg(compiler->input_signature,
+            NULL, reg_idx, dst->write_mask)))
+    {
+        FIXME("No signature element for shader input, ignoring shader input.\n");
+        return 0;
+    }
+
     builtin = get_spirv_builtin_for_sysval(compiler, sysval);
 
     component_idx = vkd3d_write_mask_get_component_idx(dst->write_mask);
@@ -3217,9 +3224,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
     }
     else
     {
-        signature_element = vkd3d_find_signature_element_for_reg(compiler->input_signature,
-                NULL, reg_idx, dst->write_mask);
-        component_type = signature_element ? signature_element->component_type : VKD3D_TYPE_FLOAT;
+        component_type = signature_element->component_type;
         input_component_count = component_count;
     }
     assert(component_count <= input_component_count);
@@ -4187,18 +4192,18 @@ static void vkd3d_dxbc_compiler_emit_dcl_input_ps(struct vkd3d_dxbc_compiler *co
 {
     uint32_t input_id;
 
-    input_id = vkd3d_dxbc_compiler_emit_input(compiler, &instruction->declaration.dst, VKD3D_SIV_NONE);
-    vkd3d_dxbc_compiler_emit_interpolation_decorations(compiler, input_id, instruction->flags);
+    if ((input_id = vkd3d_dxbc_compiler_emit_input(compiler, &instruction->declaration.dst, VKD3D_SIV_NONE)))
+        vkd3d_dxbc_compiler_emit_interpolation_decorations(compiler, input_id, instruction->flags);
 }
 
 static void vkd3d_dxbc_compiler_emit_dcl_input_ps_sysval(struct vkd3d_dxbc_compiler *compiler,
         const struct vkd3d_shader_instruction *instruction)
 {
+    const struct vkd3d_shader_register_semantic *semantic = &instruction->declaration.register_semantic;
     uint32_t input_id;
 
-    input_id = vkd3d_dxbc_compiler_emit_input(compiler, &instruction->declaration.register_semantic.reg,
-            instruction->declaration.register_semantic.sysval_semantic);
-    if (!instruction->declaration.register_semantic.sysval_semantic)
+    input_id = vkd3d_dxbc_compiler_emit_input(compiler, &semantic->reg, semantic->sysval_semantic);
+    if (input_id && !semantic->sysval_semantic)
         vkd3d_dxbc_compiler_emit_interpolation_decorations(compiler, input_id, instruction->flags);
 }
 




More information about the wine-cvs mailing list