Mesa (staging/21.2): glsl: fix variable scope for instructions inside case statements
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Aug 24 23:01:11 UTC 2021
Module: Mesa
Branch: staging/21.2
Commit: 8f18e97dd737ce4786539ca7179257785a03a77f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f18e97dd737ce4786539ca7179257785a03a77f
Author: Timothy Arceri <tarceri at itsqueeze.com>
Date: Wed Aug 18 13:57:14 2021 +1000
glsl: fix variable scope for instructions inside case statements
Fixes: 665d75cc5a23 ("glsl: Fix scoping bug in if statements.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5247
Reviewed-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12435>
(cherry picked from commit 02b394023b74620092c45734dcdb531e97d6f19d)
---
.pick_status.json | 2 +-
src/compiler/glsl/ast_to_hir.cpp | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 2709c3f9745..1ee3524dc9a 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -949,7 +949,7 @@
"description": "glsl: fix variable scope for instructions inside case statements",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "665d75cc5a23f8024034d0c4176fb281f94a30e9"
},
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;
More information about the mesa-commit
mailing list