From a3afeb4687d0e531a1adc37c504aea89d8d8d71c Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Thu, 15 Sep 2016 22:13:19 -0700 Subject: [PATCH] VideoCore: Fix dangling lambda context in shader interpreter The static meant that after the first execution, these lambda context would be pointing to a random location on the stack. Fixes a random crash when using the interpreter. --- src/video_core/shader/shader_interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp index b1eadc071..f6c86a759 100644 --- a/src/video_core/shader/shader_interpreter.cpp +++ b/src/video_core/shader/shader_interpreter.cpp @@ -77,7 +77,7 @@ void RunInterpreter(const ShaderSetup& setup, UnitState& state, unsigned const Instruction instr = { program_code[program_counter] }; const SwizzlePattern swizzle = { swizzle_data[instr.common.operand_desc_id] }; - static auto call = [&program_counter, &call_stack](UnitState& state, u32 offset, u32 num_instructions, + auto call = [&program_counter, &call_stack](UnitState& state, u32 offset, u32 num_instructions, u32 return_offset, u8 repeat_count, u8 loop_increment) { program_counter = offset - 1; // -1 to make sure when incrementing the PC we end up at the correct offset ASSERT(call_stack.size() < call_stack.capacity());