From: Mikko Rasa Date: Wed, 17 Nov 2021 13:21:53 +0000 (+0200) Subject: Fix handling of constants in Spir-V reflection X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=4f79ac1988e401b5242db437caccc0a98cf5dba1 Fix handling of constants in Spir-V reflection --- 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);