From 11fbe5dc1f764d99e27a7049e2cbcd59915846c5 Mon Sep 17 00:00:00 2001 From: Andrey Tuganov Date: Thu, 2 Mar 2017 17:24:29 -0500 Subject: [PATCH] Validator: unique type check allows runtime arrays OpTypeRuntimeArray is an aggregate and therefore can have duplicate declarations. --- source/validate_type_unique.cpp | 3 ++- test/val/val_type_unique_test.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/validate_type_unique.cpp b/source/validate_type_unique.cpp index c0dbeca..a7f4b9e 100644 --- a/source/validate_type_unique.cpp +++ b/source/validate_type_unique.cpp @@ -30,7 +30,8 @@ spv_result_t TypeUniquePass(ValidationState_t& _, const spv_parsed_instruction_t* inst) { const SpvOp opcode = static_cast(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; } diff --git a/test/val/val_type_unique_test.cpp b/test/val/val_type_unique_test.cpp index 9dd44ed..2330582 100644 --- a/test/val/val_type_unique_test.cpp +++ b/test/val/val_type_unique_test.cpp @@ -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; -- 2.7.4