glsl: Don't dead-code eliminate a uniform initializer.
authorEric Anholt <eric@anholt.net>
Tue, 24 Aug 2010 22:30:42 +0000 (15:30 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 24 Aug 2010 23:37:02 +0000 (16:37 -0700)
Partial fix for glsl-uniform-initializer-5.

src/glsl/ir_dead_code.cpp

index 7ff580d538057a10ae434a4f069066b066933b07..5cf5e99add42e85a24298de5d4b6764c78b1e61d 100644 (file)
@@ -92,6 +92,14 @@ do_dead_code(exec_list *instructions)
         /* If there are no assignments or references to the variable left,
          * then we can remove its declaration.
          */
+
+        /* uniform initializers are precious, and could get used by another
+         * stage.
+         */
+        if (entry->var->mode == ir_var_uniform &&
+            entry->var->constant_value)
+           continue;
+
         entry->var->remove();
         progress = true;