From 02b394023b74620092c45734dcdb531e97d6f19d Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Wed, 18 Aug 2021 13:57:14 +1000 Subject: [PATCH] glsl: fix variable scope for instructions inside case statements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 665d75cc5a23 ("glsl: Fix scoping bug in if statements.") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5247 Reviewed-by: Marcin Ĺšlusarz Part-of: --- src/compiler/glsl/ast_to_hir.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 370f6934bd4..cb9dd0dbd99 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -6830,8 +6830,11 @@ ir_rvalue * ast_switch_body::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - if (stmts != NULL) + if (stmts != NULL) { + state->symbols->push_scope(); stmts->hir(instructions, state); + state->symbols->pop_scope(); + } /* Switch bodies do not have r-values. */ return NULL;