spirv: Use vtn_constan_uint() for array lengths and gather components
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 6 Jun 2019 14:49:55 +0000 (09:49 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Wed, 19 Jun 2019 21:05:54 +0000 (21:05 +0000)
Reviewed-by: Karol Herbst <kherbst@redhat.com>
src/compiler/spirv/spirv_to_nir.c

index ccd11fa63294a04b344696b9b3d6d5cb59620b11..559408e3a088200f66d103290f1ed86b5f29575c 100644 (file)
@@ -1271,8 +1271,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
          /* A length of 0 is used to denote unsized arrays */
          val->type->length = 0;
       } else {
-         val->type->length =
-            vtn_value(b, w[3], vtn_value_type_constant)->constant->values[0][0].u32;
+         val->type->length = vtn_constant_uint(b, w[3]);
       }
 
       val->type->base_type = vtn_base_type_array;
@@ -2280,8 +2279,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
 
    case SpvOpImageGather:
       /* This has a component as its next source */
-      gather_component =
-         vtn_value(b, w[idx++], vtn_value_type_constant)->constant->values[0][0].u32;
+      gather_component = vtn_constant_uint(b, w[idx++]);
       break;
 
    default: