Validator: unique type check allows runtime arrays
authorAndrey Tuganov <andreyt@google.com>
Thu, 2 Mar 2017 22:24:29 +0000 (17:24 -0500)
committerAndrey Tuganov <andreyt@google.com>
Thu, 2 Mar 2017 22:24:29 +0000 (17:24 -0500)
OpTypeRuntimeArray is an aggregate and therefore can have duplicate
declarations.

source/validate_type_unique.cpp
test/val/val_type_unique_test.cpp

index c0dbeca..a7f4b9e 100644 (file)
@@ -30,7 +30,8 @@ spv_result_t TypeUniquePass(ValidationState_t& _,
                             const spv_parsed_instruction_t* inst) {
   const SpvOp opcode = static_cast<SpvOp>(inst->opcode);
   if (spvOpcodeGeneratesType(opcode)) {
-    if (opcode == SpvOpTypeArray || opcode == SpvOpTypeStruct) {
+    if (opcode == SpvOpTypeArray || opcode == SpvOpTypeRuntimeArray ||
+        opcode == SpvOpTypeStruct) {
       // Duplicate declarations of aggregates are allowed.
       return SPV_SUCCESS;
     }
index 9dd44ed..2330582 100644 (file)
@@ -59,6 +59,8 @@ OpMemoryModel Logical GLSL450
 %struct2 = OpTypeStruct %floatt %floatt %vec3t
 %false = OpConstantFalse %boolt
 %true = OpConstantTrue %boolt
+%runtime_arrayt = OpTypeRuntimeArray %floatt
+%runtime_arrayt2 = OpTypeRuntimeArray %floatt
 )";
 
   return header;