From: Eric Anholt Date: Fri, 6 Nov 2009 21:04:54 +0000 (-0800) Subject: mesa: Fix remove_instructions to successfully remove when removeFlags[0]. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f3cacfe216fb58b913bbc23de49d696a33da69e1;p=mesa.git mesa: Fix remove_instructions to successfully remove when removeFlags[0]. This fixes the dead code elimination to work on the particular code mentioned in the previous commit. --- diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index 5aff16be46d..b4658cb37f9 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -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; }