]> git.tdb.fi Git - libs/gl.git/commitdiff
Add a cached load when initializing a variable
authorMikko Rasa <tdb@tdb.fi>
Sat, 24 Apr 2021 19:31:31 +0000 (22:31 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 24 Apr 2021 19:31:31 +0000 (22:31 +0300)
source/glsl/spirv.cpp

index 35d46ab7f9333b503897585de8bbebded43b62f7..6ef58e909f1f2345c4468e5567da282749facfcb 100644 (file)
@@ -1623,7 +1623,10 @@ void SpirVGenerator::visit(VariableDeclaration &var)
                }
 
                if(init_id && current_function)
+               {
                        writer.write_op(content.function_body, OP_STORE, var_id, init_id);
+                       variable_load_ids[&var] = init_id;
+               }
        }
 
        writer.write_op_name(var_id, var.name);