From 89e7d218c8623370f98243000b7e703075fb1d0a Mon Sep 17 00:00:00 2001 From: lifpan Date: Thu, 5 Sep 2019 06:56:05 +0800 Subject: [PATCH] Fix ParsedIR::mark_used_as_array_length(uint32_t id) --- spirv_cross_parsed_ir.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spirv_cross_parsed_ir.cpp b/spirv_cross_parsed_ir.cpp index a5c87f45..8464949c 100644 --- a/spirv_cross_parsed_ir.cpp +++ b/spirv_cross_parsed_ir.cpp @@ -356,8 +356,16 @@ void ParsedIR::mark_used_as_array_length(uint32_t id) case TypeConstantOp: { auto &cop = get(id); - for (uint32_t arg_id : cop.arguments) - mark_used_as_array_length(arg_id); + if (cop.opcode == OpCompositeExtract) + mark_used_as_array_length(cop.arguments[0]); + else if (cop.opcode == OpCompositeInsert) + { + mark_used_as_array_length(cop.arguments[0]); + mark_used_as_array_length(cop.arguments[1]); + } + else + for (uint32_t arg_id : cop.arguments) + mark_used_as_array_length(arg_id); break; }