Module: Mesa
Branch: glsl2
Commit: 9303e358cb3062f62c39961ebd4708bf63db03c1
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9303e358cb3062f62c39961ebd4708bf63db03c1

Author: Ian Romanick <[email protected]>
Date:   Mon Jul 19 12:33:54 2010 -0700

linker: Move global instructions from the linked shader first

For the shader containing 'main', use the linked shader (i.e., the
clone of the original shader that contained main) as the source for
global instructions to move into main.

---

 src/glsl/linker.cpp |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index c71c07d..d46744e 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -687,12 +687,16 @@ link_intrastage_shaders(struct gl_shader_program *prog,
    /* Move any instructions other than variable declarations or function
     * declarations into main.
     */
-   exec_node *insertion_point = (exec_node *) &main_sig->body;
+   exec_node *insertion_point =
+      move_non_declarations(linked->ir, (exec_node *) &main_sig->body, false,
+                           linked);
+
    for (unsigned i = 0; i < num_shaders; i++) {
+      if (shader_list[i] == main)
+        continue;
+
       insertion_point = move_non_declarations(shader_list[i]->ir,
-                                             insertion_point,
-                                             (shader_list[i] != main),
-                                             linked);
+                                             insertion_point, true, linked);
    }
 
    /* Resolve initializers for global variables in the linked shader.

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to