From 1c58cd2d741c962484e55decc069ed3046b40f60 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 24 Apr 2021 22:31:31 +0300 Subject: [PATCH] Add a cached load when initializing a variable --- source/glsl/spirv.cpp | 3 +++ 1 file changed, 3 insertions(+) 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); -- 2.45.2