[Mesa-dev] [PATCH 6/9] ff_fragment_shader: Be more aggressive in optimization pre-linking.

Eric Anholt eric at anholt.net
Fri Mar 11 16:06:50 PST 2011


---
 src/mesa/main/ff_fragment_shader.cpp |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 50d6be7..e113cdb 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -1429,7 +1429,14 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
 
    validate_ir_tree(p.shader->ir);
 
-   while (do_common_optimization(p.shader->ir, false, 32))
+   /* Tell do_common_optimization that we're linked even though we
+    * aren't.  We aren't linking this shader against any other
+    * targets, and it would prevent us from cleaning up a bunch of
+    * builtin variable declarations which result in a bunch of extra
+    * link-time processing and extra unnecessary memory allocation in
+    * this shader.
+    */
+   while (do_common_optimization(p.shader->ir, true, 32))
       ;
    reparent_ir(p.shader->ir, p.shader->ir);
 
-- 
1.7.4.1



More information about the mesa-dev mailing list