i965: Fix ENDLOOP to only patch up this loop's BREAK and CONT.
authorEric Anholt <eric@anholt.net>
Tue, 9 Mar 2010 22:22:51 +0000 (14:22 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 9 Mar 2010 22:42:17 +0000 (14:42 -0800)
Corresponds to d225a25e21a24508aea3b877c78beb35502e942d and fixes
piglit glsl-fs-loop-nested.  Bug #25173.

src/mesa/drivers/dri/i965/brw_wm_glsl.c

index 13306accda763ba3e18eb9057bea4c495e0c1b1b..ea3c2405af9bd5c6cfc31591c65e15c58c2226d0 100644 (file)
@@ -2012,11 +2012,13 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
                   /* patch all the BREAK/CONT instructions from last BGNLOOP */
                   while (inst0 > loop_inst[loop_depth]) {
                      inst0--;
-                     if (inst0->header.opcode == BRW_OPCODE_BREAK) {
+                     if (inst0->header.opcode == BRW_OPCODE_BREAK &&
+                        inst0->bits3.if_else.jump_count == 0) {
                        inst0->bits3.if_else.jump_count = br * (inst1 - inst0 + 1);
                        inst0->bits3.if_else.pop_count = 0;
                      }
-                     else if (inst0->header.opcode == BRW_OPCODE_CONTINUE) {
+                     else if (inst0->header.opcode == BRW_OPCODE_CONTINUE &&
+                             inst0->bits3.if_else.jump_count == 0) {
                         inst0->bits3.if_else.jump_count = br * (inst1 - inst0);
                         inst0->bits3.if_else.pop_count = 0;
                      }