]> git.tdb.fi Git - libs/gl.git/commitdiff
Clear r_constant_result for a function call by default
authorMikko Rasa <tdb@tdb.fi>
Thu, 22 Apr 2021 12:30:41 +0000 (15:30 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 22 Apr 2021 12:30:41 +0000 (15:30 +0300)
Also clear it before processing a variable initializer, just in case.

source/glsl/spirv.cpp

index 52885342b004492a11cb8e4bb8c61d54801cea79..7d6edf656a4097607e70b1a68208f3c523e9d212 100644 (file)
@@ -1051,6 +1051,7 @@ void SpirVGenerator::visit(FunctionCall &call)
                throw internal_error("function call in constant expression");
 
        Id result_type_id = get_id(*call.type);
+       r_constant_result = false;
 
        if(call.constructor)
                visit_constructor(call, argument_ids, all_args_const);
@@ -1574,6 +1575,7 @@ void SpirVGenerator::visit(VariableDeclaration &var)
                {
                        SetFlag set_const(constant_expression, !current_function);
                        r_expression_result_id = 0;
+                       r_constant_result = false;
                        var.init_expression->visit(*this);
                        init_id = r_expression_result_id;
                }