From 4f79ac1988e401b5242db437caccc0a98cf5dba1 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 17 Nov 2021 15:21:53 +0200 Subject: [PATCH] Fix handling of constants in Spir-V reflection --- source/core/module.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/core/module.cpp b/source/core/module.cpp index dee12461..116c6241 100644 --- a/source/core/module.cpp +++ b/source/core/module.cpp @@ -428,13 +428,14 @@ void SpirVModule::Reflection::reflect_pointer_type(CodeIterator op) void SpirVModule::Reflection::reflect_constant(CodeIterator op) { + unsigned opcode = get_opcode(*op); unsigned id = *(op+2); Constant &cnst = constants[id]; cnst.name = names[id]; cnst.type = types[*(op+1)].type; - if(*op==OP_CONSTANT_TRUE || *op==OP_SPEC_CONSTANT_TRUE) + if(opcode==OP_CONSTANT_TRUE || opcode==OP_SPEC_CONSTANT_TRUE) cnst.i_value = true; - else if(*op==OP_CONSTANT_FALSE || *op==OP_SPEC_CONSTANT_FALSE) + else if(opcode==OP_CONSTANT_FALSE || opcode==OP_SPEC_CONSTANT_FALSE) cnst.i_value = false; else if(cnst.type==INT || cnst.type==UNSIGNED_INT) cnst.i_value = *(op+3); -- 2.43.0