summaryrefslogtreecommitdiff
path: root/src/glsl/ir_dead_code.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-08-24 15:30:42 -0700
committerEric Anholt <eric@anholt.net>2010-08-24 16:37:02 -0700
commit7de4d8fe11c53e59265b8a4252ab9940ffcc9929 (patch)
tree946abe70aef4622a7aa9e6c0aa8cc7527a8276b8 /src/glsl/ir_dead_code.cpp
parent37f0654fa56a97c6f4ea6220c97758ee95267e0b (diff)
glsl: Don't dead-code eliminate a uniform initializer.
Partial fix for glsl-uniform-initializer-5.
Diffstat (limited to 'src/glsl/ir_dead_code.cpp')
-rw-r--r--src/glsl/ir_dead_code.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp
index 7ff580d538..5cf5e99add 100644
--- a/src/glsl/ir_dead_code.cpp
+++ b/src/glsl/ir_dead_code.cpp
@@ -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;