From: Mikko Rasa Date: Sat, 24 Apr 2021 19:31:31 +0000 (+0300) Subject: Add a cached load when initializing a variable X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=1c58cd2d741c962484e55decc069ed3046b40f60;p=libs%2Fgl.git Add a cached load when initializing a variable --- diff --git a/source/glsl/spirv.cpp b/source/glsl/spirv.cpp index 35d46ab7..6ef58e90 100644 --- a/source/glsl/spirv.cpp +++ b/source/glsl/spirv.cpp @@ -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);