[Mesa-dev] [PATCH 07/11] glsl_to_tgsi: enable copy propagation for tessellation shaders

Marek Olšák maraeo at gmail.com
Fri Sep 29 12:25:30 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

just don't propagate output reads
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 ++----
 1 file changed, 2 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 50a71e4..2d62213 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4940,20 +4940,21 @@ glsl_to_tgsi_visitor::copy_propagate(void)
 
       /* If this is a copy, add it to the ACP. */
       if (inst->op == TGSI_OPCODE_MOV &&
           inst->dst[0].file == PROGRAM_TEMPORARY &&
           !(inst->dst[0].file == inst->src[0].file &&
              inst->dst[0].index == inst->src[0].index) &&
           !inst->dst[0].reladdr &&
           !inst->dst[0].reladdr2 &&
           !inst->saturate &&
           inst->src[0].file != PROGRAM_ARRAY &&
+          inst->src[0].file != PROGRAM_OUTPUT &&
           !inst->src[0].reladdr &&
           !inst->src[0].reladdr2 &&
           !inst->src[0].negate &&
           !inst->src[0].abs) {
          for (int i = 0; i < 4; i++) {
             if (inst->dst[0].writemask & (1 << i)) {
                acp[4 * inst->dst[0].index + i] = inst;
                acp_level[4 * inst->dst[0].index + i] = level;
             }
          }
@@ -6595,24 +6596,21 @@ get_mesa_program_tgsi(struct gl_context *ctx,
                 last_writes[i]);
       ralloc_free(first_writes);
       ralloc_free(first_reads);
       ralloc_free(last_writes);
       ralloc_free(last_reads);
    }
 #endif
 
    /* Perform optimizations on the instructions in the glsl_to_tgsi_visitor. */
    v->simplify_cmp();
-
-   if (shader->Stage != MESA_SHADER_TESS_CTRL &&
-       shader->Stage != MESA_SHADER_TESS_EVAL)
-      v->copy_propagate();
+   v->copy_propagate();
 
    while (v->eliminate_dead_code());
 
    v->merge_two_dsts();
    if (!skip_merge_registers)
       v->merge_registers();
    v->renumber_registers();
 
    /* Write the END instruction. */
    v->emit_asm(NULL, TGSI_OPCODE_END);
-- 
2.7.4



More information about the mesa-dev mailing list