nir/spirv: Fix the UBO loading case of a single row-major matric column
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 1 Feb 2016 21:26:59 +0000 (13:26 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 1 Feb 2016 22:03:05 +0000 (14:03 -0800)
src/glsl/nir/spirv/vtn_variables.c

index ee1e3da2e087c9d00e2e69ac5b697aa1ff1a565a..7d44cf4be9e37ac3dac4d17e39f95cabfb779a65 100644 (file)
@@ -490,8 +490,11 @@ _vtn_block_load_store(struct vtn_builder *b, nir_intrinsic_op op, bool load,
                _vtn_load_store_tail(b, op, load, index, offset, inout,
                                     glsl_scalar_type(base_type));
             } else {
-               /* Picking one element off each column */
+               /* Grabbing a column; picking one element off each row */
                unsigned num_comps = glsl_get_vector_elements(type->type);
+               const struct glsl_type *column_type =
+                  glsl_get_column_type(type->type);
+
                nir_ssa_def *comps[4];
                for (unsigned i = 0; i < num_comps; i++) {
                   nir_ssa_def *elem_offset =
@@ -511,7 +514,7 @@ _vtn_block_load_store(struct vtn_builder *b, nir_intrinsic_op op, bool load,
 
                if (load) {
                   if (*inout == NULL)
-                     *inout = vtn_create_ssa_value(b, type->type);
+                     *inout = vtn_create_ssa_value(b, column_type);
 
                   (*inout)->def = nir_vec(&b->nb, comps, num_comps);
                }