Mesa (master): glsl_to_tgsi: Use the GLSL compiler' s new remove-output-reads pass.

Dave Airlie airlied at kemper.freedesktop.org
Fri Jan 6 13:50:30 UTC 2012


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

Author: Vincent Lejeune <vljn at ovi.com>
Date:   Mon Jan  2 20:17:38 2012 +0100

glsl_to_tgsi: Use the GLSL compiler's new remove-output-reads pass.

The existing glsl_to_tgsi::remove_output_read pass did not work properly
when indirect addressing was involved; this commit replaces it with a
lowering pass that occurs before TGSI code generation.

Fixes varying-array related piglit tests.

Signed-off-by: Vincent Lejeune <vljn at ovi.com>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 9e61c65..1b956a7 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4894,6 +4894,13 @@ get_mesa_program(struct gl_context *ctx,
    _mesa_generate_parameters_list_for_uniforms(shader_program, shader,
 					       prog->Parameters);
 
+   if (!screen->get_shader_param(screen, pipe_shader_type,
+                                 PIPE_SHADER_CAP_OUTPUT_READ)) {
+      /* Remove reads to output registers, and to varyings in vertex shaders. */
+      lower_output_reads(shader->ir);
+   }
+
+
    /* Emit intermediate IR for main(). */
    visit_exec_list(shader->ir, v);
 
@@ -4940,14 +4947,6 @@ get_mesa_program(struct gl_context *ctx,
    }
 #endif
 
-   if (!screen->get_shader_param(screen, pipe_shader_type,
-                                 PIPE_SHADER_CAP_OUTPUT_READ)) {
-      /* Remove reads to output registers, and to varyings in vertex shaders. */
-      v->remove_output_reads(PROGRAM_OUTPUT);
-      if (target == GL_VERTEX_PROGRAM_ARB)
-         v->remove_output_reads(PROGRAM_VARYING);
-   }
-   
    /* Perform optimizations on the instructions in the glsl_to_tgsi_visitor. */
    v->simplify_cmp();
    v->copy_propagate();




More information about the mesa-commit mailing list