Signed-off-by: Karol Herbst <kher...@redhat.com>
---
 src/compiler/spirv/vtn_private.h   |  5 +++--
 src/compiler/spirv/vtn_variables.c | 14 +++++++-------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index 510c12faa87..45b581bf80e 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -700,12 +700,13 @@ void vtn_local_store(struct vtn_builder *b, struct 
vtn_ssa_value *src,
                      nir_deref_var *dest);
 
 struct vtn_ssa_value *vtn_pointer_load(struct vtn_builder *b,
-                                       struct vtn_pointer *ptr);
+                                       struct vtn_pointer *ptr,
+                                       struct vtn_type *);
 void vtn_pointer_store(struct vtn_builder *b, struct vtn_ssa_value *src,
                        struct vtn_pointer *ptr);
 
 struct vtn_ssa_value *
-vtn_variable_load(struct vtn_builder *b, struct vtn_pointer *src);
+vtn_variable_load(struct vtn_builder *b, struct vtn_pointer *src, struct 
vtn_type *);
 
 void vtn_variable_store(struct vtn_builder *b, struct vtn_ssa_value *src,
                         struct vtn_pointer *dest);
diff --git a/src/compiler/spirv/vtn_variables.c 
b/src/compiler/spirv/vtn_variables.c
index 6cf1a63f8c9..76b38b85e80 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -739,9 +739,9 @@ vtn_local_store(struct vtn_builder *b, struct vtn_ssa_value 
*src,
 }
 
 struct vtn_ssa_value *
-vtn_pointer_load(struct vtn_builder *b, struct vtn_pointer *ptr)
+vtn_pointer_load(struct vtn_builder *b, struct vtn_pointer *ptr, struct 
vtn_type *res_type)
 {
-   const struct glsl_type *type = ptr->type->type;
+   const struct glsl_type *type = res_type->type;
    struct vtn_ssa_value *val = vtn_create_ssa_value(b, type);
    nir_intrinsic_op op = nir_intrinsic_load_global;
 
@@ -1207,7 +1207,7 @@ _vtn_variable_load_store(struct vtn_builder *b, bool load,
           * with it.  Just directly generate load/store_global intrinsics:
           */
          if (load) {
-            *inout = vtn_pointer_load(b, ptr);
+            *inout = vtn_pointer_load(b, ptr, ptr->type);
          } else {
             vtn_pointer_store(b, *inout, ptr);
          }
@@ -1244,12 +1244,12 @@ _vtn_variable_load_store(struct vtn_builder *b, bool 
load,
 }
 
 struct vtn_ssa_value *
-vtn_variable_load(struct vtn_builder *b, struct vtn_pointer *src)
+vtn_variable_load(struct vtn_builder *b, struct vtn_pointer *src, struct 
vtn_type *type)
 {
    if (vtn_pointer_is_external_block(b, src)) {
       return vtn_block_load(b, src);
    } else if (!src->var) {
-      return vtn_pointer_load(b, src);
+      return vtn_pointer_load(b, src, type);
    } else {
       struct vtn_ssa_value *val = NULL;
       _vtn_variable_load_store(b, true, src, &val);
@@ -1298,7 +1298,7 @@ _vtn_variable_copy(struct vtn_builder *b, struct 
vtn_pointer *dest,
        * ensure that matrices get loaded in the optimal way even if they
        * are storred row-major in a UBO.
        */
-      vtn_variable_store(b, vtn_variable_load(b, src), dest);
+      vtn_variable_store(b, vtn_variable_load(b, src, src->type), dest);
       return;
 
    case GLSL_TYPE_ARRAY:
@@ -2322,7 +2322,7 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
          return;
       }
 
-      vtn_push_ssa(b, w[2], res_type, vtn_variable_load(b, src));
+      vtn_push_ssa(b, w[2], res_type, vtn_variable_load(b, src, res_type));
       break;
    }
 
-- 
2.14.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to