glsl: fix variable scope for instructions inside case statements

Fixes: 665d75cc5a ("glsl: Fix scoping bug in if statements.")

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5247

Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12435>
This commit is contained in:
Timothy Arceri 2021-08-18 13:57:14 +10:00 committed by Marge Bot
parent 067599f8bc
commit 02b394023b
1 changed files with 4 additions and 1 deletions

View File

@ -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;