spirv: Set lengths on scalar and vector types
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 6 Dec 2017 17:13:29 +0000 (09:13 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 12 Dec 2017 03:02:47 +0000 (19:02 -0800)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/compiler/spirv/spirv_to_nir.c

index e5d447f23a97c2a55c6cc836a3867919522123f1..5d105431763d20b67eb611a35c611176adec9d53 100644 (file)
@@ -887,6 +887,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
    case SpvOpTypeBool:
       val->type->base_type = vtn_base_type_scalar;
       val->type->type = glsl_bool_type();
+      val->type->length = 1;
       break;
    case SpvOpTypeInt: {
       int bit_size = w[2];
@@ -905,6 +906,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
       default:
          vtn_fail("Invalid int bit size");
       }
+      val->type->length = 1;
       break;
    }
 
@@ -924,6 +926,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
       default:
          vtn_fail("Invalid float bit size");
       }
+      val->type->length = 1;
       break;
    }
 
@@ -934,6 +937,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
       vtn_assert(glsl_type_is_scalar(base->type));
       val->type->base_type = vtn_base_type_vector;
       val->type->type = glsl_vector_type(glsl_get_base_type(base->type), elems);
+      val->type->length = elems;
       val->type->stride = glsl_get_bit_size(base->type) / 8;
       val->type->array_element = base;
       break;