[Mesa-dev] [PATCH 2/3] st/mesa: use PIPE_CAP_SHADER_OUTPUT_READ

Vadim Girlin vadimgirlin at gmail.com
Mon Nov 14 04:57:34 PST 2011


Don't replace outputs with temps when the driver supports reading outputs.

Signed-off-by: Vadim Girlin <vadimgirlin at gmail.com>
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index b133164..8c40682 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4874,6 +4874,7 @@ get_mesa_program(struct gl_context *ctx,
 {
    glsl_to_tgsi_visitor* v = new glsl_to_tgsi_visitor();
    struct gl_program *prog;
+   struct pipe_screen * screen = st_context(ctx)->pipe->screen;
    GLenum target;
    const char *target_string;
    bool progress;
@@ -4960,10 +4961,12 @@ get_mesa_program(struct gl_context *ctx,
    }
 #endif
 
-   /* 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);
+   if (!screen->get_param(screen, PIPE_CAP_SHADER_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();
-- 
1.7.7.1



More information about the mesa-dev mailing list