diff options
author | Tapani Pälli <[email protected]> | 2014-08-06 09:46:54 +0300 |
---|---|---|
committer | Tapani Pälli <[email protected]> | 2014-10-20 07:55:58 +0300 |
commit | 73dd50acf6d244979c2a657906aa56d3ac60d550 (patch) | |
tree | 5b406b48aa978187ab817819442ecf365de54df3 /src/glsl/glsl_parser_extras.h | |
parent | 6212d2402df4ad0658cbb98ce889e35ef5f32fa3 (diff) |
glsl: implement switch flow control using a loop
Patch removes old variable based logic for handling a break inside
switch. Switch is put inside a loop so that existing infrastructure
for loop flow control can be used for the switch, now also dead code
elimination works properly.
Possible 'continue' call inside a switch needs now special handling
which is taken care of by detecting continue, breaking out and calling
continue for the outside loop.
v2: remove one unnecessary ir_expression (Curro)
Fixes following Piglit tests:
fs-exec-after-break.shader_test
fs-conditional-break.shader_test
No Piglit or es3conform regressions.
Signed-off-by: Tapani Pälli <[email protected]>
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/glsl/glsl_parser_extras.h')
-rw-r--r-- | src/glsl/glsl_parser_extras.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index c8b94781c70..c14d74c9846 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -40,9 +40,11 @@ struct glsl_switch_state { /** Temporary variables needed for switch statement. */ ir_variable *test_var; ir_variable *is_fallthru_var; - ir_variable *is_break_var; class ast_switch_statement *switch_nesting_ast; + /** Used to detect if 'continue' was called inside a switch. */ + ir_variable *continue_inside; + /** Used to set condition if 'default' label should be chosen. */ ir_variable *run_default; |