=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: vkd3d-shader: Assign unique locations for patch constants.

Alexandre Julliard julliard at winehq.org
Wed Jun 12 16:27:17 CDT 2019


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Wed Jun 12 14:08:02 2019 +0200

vkd3d-shader: Assign unique locations for patch constants.

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 | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index e308ef3..a559da1 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -3937,10 +3937,15 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
     }
     else
     {
+        unsigned int location = reg_idx;
+
+        if (reg->type == VKD3DSPR_PATCHCONST)
+            location += compiler->input_signature->element_count;
+
         input_id = vkd3d_dxbc_compiler_emit_array_variable(compiler, &builder->global_stream,
                 storage_class, component_type, input_component_count, array_size);
         vkd3d_spirv_add_iface_variable(builder, input_id);
-        vkd3d_spirv_build_op_decorate1(builder, input_id, SpvDecorationLocation, reg_idx);
+        vkd3d_spirv_build_op_decorate1(builder, input_id, SpvDecorationLocation, location);
         if (component_idx)
             vkd3d_spirv_build_op_decorate1(builder, input_id, SpvDecorationComponent, component_idx);
 
@@ -4301,6 +4306,11 @@ static void vkd3d_dxbc_compiler_emit_output(struct vkd3d_dxbc_compiler *compiler
         }
         else
         {
+            unsigned int location = reg->idx[0].offset;
+
+            if (is_patch_constant)
+                location += compiler->output_signature->element_count;
+
             id = vkd3d_dxbc_compiler_emit_array_variable(compiler, &builder->global_stream,
                     storage_class, component_type, output_component_count, array_size);
             vkd3d_spirv_add_iface_variable(builder, id);
@@ -4312,7 +4322,7 @@ static void vkd3d_dxbc_compiler_emit_output(struct vkd3d_dxbc_compiler *compiler
             }
             else
             {
-                vkd3d_spirv_build_op_decorate1(builder, id, SpvDecorationLocation, reg->idx[0].offset);
+                vkd3d_spirv_build_op_decorate1(builder, id, SpvDecorationLocation, location);
             }
 
             if (component_idx)




More information about the wine-cvs mailing list