mesa: Fix remove_instructions to successfully remove when removeFlags[0].
authorEric Anholt <eric@anholt.net>
Fri, 6 Nov 2009 21:04:54 +0000 (13:04 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 6 Nov 2009 21:16:49 +0000 (13:16 -0800)
This fixes the dead code elimination to work on the particular code
mentioned in the previous commit.

src/mesa/shader/prog_optimize.c

index 5aff16be46d0ceb3a0718ff775f465910d7ceec2..b4658cb37f904347eb5c2bd96bd43f3f9a4bed66 100644 (file)
@@ -73,6 +73,12 @@ remove_instructions(struct gl_program *prog, const GLboolean *removeFlags)
          }
       }
    }
+   /* Finish removing if the first instruction was to be removed. */
+   if (removeCount > 0) {
+      GLint removeStart = removeEnd - removeCount + 1;
+      _mesa_delete_instructions(prog, removeStart, removeCount);
+      removeStart = removeCount = 0; /* reset removal info */
+   }
    return totalRemoved;
 }