From 48deb4dbf278c03ea49aeaa7f9d9eda231def817 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tapani=20P=C3=A4lli?= <tapani.palli@intel.com>
Date: Mon, 14 Jul 2014 09:45:46 +0300
Subject: glsl: handle a switch where default is in the middle of cases
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This fixes following tests in es3conform:

   shaders.switch.default_not_last_dynamic_vertex
   shaders.switch.default_not_last_dynamic_fragment

and makes following tests in Piglit pass:

   glsl-1.30/execution/switch/fs-default-notlast-fallthrough
   glsl-1.30/execution/switch/fs-default_notlast

No Piglit regressions.

v2: take away unnecessary ir_if, just use conditional assignment
v3: use foreach_in_list instead of foreach_list

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com> (v2)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v3)
---
 src/glsl/glsl_parser_extras.h | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'src/glsl/glsl_parser_extras.h')

diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 1791816..6df41d4 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -43,6 +43,9 @@ struct glsl_switch_state {
    ir_variable *is_break_var;
    class ast_switch_statement *switch_nesting_ast;
 
+   /** Used to set condition if 'default' label should be chosen. */
+   ir_variable *run_default;
+
    /** Table of constant values already used in case labels */
    struct hash_table *labels_ht;
    class ast_case_label *previous_default;
-- 
cgit v1.1