[Mesa-dev] [PATCH 2/3] glsl/lower_output_reads: bail early in tessellation control shaders

Nicolai Hähnle nhaehnle at gmail.com
Thu Nov 17 22:00:09 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

This whole pass is a no-op.
---
 src/compiler/glsl/lower_output_reads.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/lower_output_reads.cpp b/src/compiler/glsl/lower_output_reads.cpp
index 8a375ac..b0045f0 100644
--- a/src/compiler/glsl/lower_output_reads.cpp
+++ b/src/compiler/glsl/lower_output_reads.cpp
@@ -89,22 +89,20 @@ output_read_remover::~output_read_remover()
 {
    _mesa_hash_table_destroy(replacements, NULL);
    ralloc_free(mem_ctx);
 }
 
 ir_visitor_status
 output_read_remover::visit(ir_dereference_variable *ir)
 {
    if (ir->var->data.mode != ir_var_shader_out)
       return visit_continue;
-   if (stage == MESA_SHADER_TESS_CTRL)
-      return visit_continue;
 
    hash_entry *entry = _mesa_hash_table_search(replacements, ir->var);
    ir_variable *temp = entry ? (ir_variable *) entry->data : NULL;
 
    /* If we don't have an existing temporary, create one. */
    if (temp == NULL) {
       void *var_ctx = ralloc_parent(ir->var);
       temp = new(var_ctx) ir_variable(ir->var->type, ir->var->name,
                                       ir_var_temporary);
       _mesa_hash_table_insert(replacements, ir->var, temp);
@@ -166,13 +164,19 @@ output_read_remover::visit_leave(ir_function_signature *sig)
    if (strcmp(sig->function_name(), "main") != 0)
       return visit_continue;
 
    hash_table_call_foreach(replacements, emit_main_copy, sig);
    return visit_continue;
 }
 
 void
 lower_output_reads(unsigned stage, exec_list *instructions)
 {
+   /* Due to the possible interactions between multiple tessellation control
+    * shader invocations, we leave output variables as-is.
+    */
+   if (stage == MESA_SHADER_TESS_CTRL)
+      return;
+
    output_read_remover v(stage);
    visit_list_elements(&v, instructions);
 }
-- 
2.7.4



More information about the mesa-dev mailing list