Mesa (master): glsl: Don't dead-code eliminate a uniform initializer.

Eric Anholt anholt at kemper.freedesktop.org
Tue Aug 24 23:38:19 UTC 2010


Module: Mesa
Branch: master
Commit: 7de4d8fe11c53e59265b8a4252ab9940ffcc9929
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7de4d8fe11c53e59265b8a4252ab9940ffcc9929

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Aug 24 15:30:42 2010 -0700

glsl: Don't dead-code eliminate a uniform initializer.

Partial fix for glsl-uniform-initializer-5.

---

 src/glsl/ir_dead_code.cpp |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp
index 7ff580d..5cf5e99 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;
 




More information about the mesa-commit mailing list