summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2014-07-25 09:40:13 +0300
committerTapani Pälli <[email protected]>2014-08-04 12:32:59 +0300
commitd66acc70777480439a67d59977169595b1cf4418 (patch)
tree95174a9d373da8d4f0caea9d571e247200ff579a
parent47e5039680787d1d7072caffdb767a54ecd63218 (diff)
glsl: fix switch statement default case regressions
This patch fixes regressions caused by commit 48deb4d. Regressions happened because 'run_default' var did not get initialized when default case was the last one. Now all the switch tests in es3conform suite are passing. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Chris Forbes <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81857
-rw-r--r--src/glsl/ast_to_hir.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index a15ee9c0572..7249a06c928 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -4597,12 +4597,6 @@ ast_case_statement_list::hir(exec_list *instructions,
*/
if (!default_case.is_empty()) {
- /* Default case was the last one, no checks required. */
- if (after_default.is_empty()) {
- instructions->append_list(&default_case);
- return NULL;
- }
-
ir_rvalue *const true_val = new (state) ir_constant(true);
ir_dereference_variable *deref_run_default_var =
new(state) ir_dereference_variable(state->switch_state.run_default);
@@ -4614,6 +4608,12 @@ ast_case_statement_list::hir(exec_list *instructions,
new(state) ir_assignment(deref_run_default_var, true_val);
instructions->push_tail(init_var);
+ /* Default case was the last one, no checks required. */
+ if (after_default.is_empty()) {
+ instructions->append_list(&default_case);
+ return NULL;
+ }
+
foreach_in_list(ir_instruction, ir, &after_default) {
ir_assignment *assign = ir->as_assignment();