glsl: implement switch flow control using a loop
authorTapani Pälli <tapani.palli@intel.com>
Wed, 6 Aug 2014 06:46:54 +0000 (09:46 +0300)
committerTapani Pälli <tapani.palli@intel.com>
Mon, 20 Oct 2014 04:55:58 +0000 (07:55 +0300)
commit73dd50acf6d244979c2a657906aa56d3ac60d550
tree5b406b48aa978187ab817819442ecf365de54df3
parent6212d2402df4ad0658cbb98ce889e35ef5f32fa3
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 <tapani.palli@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/glsl/ast_to_hir.cpp
src/glsl/glsl_parser_extras.h