nir/spirv: Fix a bug in indirect OpAccessChain handling
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 14 Oct 2015 03:00:05 +0000 (20:00 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 14 Oct 2015 03:00:18 +0000 (20:00 -0700)
src/glsl/nir/spirv_to_nir.c

index d0fb6a255a570369edab4860e618f9f596773284..6503b2590d7a7b43dc12d97214e668c1c6c18987 100644 (file)
@@ -1381,10 +1381,10 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
                deref_arr->base_offset = idx;
             } else {
                assert(idx_val->value_type == vtn_value_type_ssa);
+               assert(glsl_type_is_scalar(idx_val->ssa->type));
                deref_arr->deref_array_type = nir_deref_array_type_indirect;
                deref_arr->base_offset = 0;
-               deref_arr->indirect =
-                  nir_src_for_ssa(vtn_ssa_value(b, w[1])->def);
+               deref_arr->indirect = nir_src_for_ssa(idx_val->ssa->def);
             }
             tail->child = &deref_arr->deref;
             break;