]> git.tdb.fi Git - libs/gl.git/commitdiff
Fix handling of constants in Spir-V reflection
authorMikko Rasa <tdb@tdb.fi>
Wed, 17 Nov 2021 13:21:53 +0000 (15:21 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 17 Nov 2021 13:28:34 +0000 (15:28 +0200)
source/core/module.cpp

index dee124619f1c8a2ec3db7109b77d992a9109d158..116c6241a184d321b6408122713873b16657412e 100644 (file)
@@ -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);