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

Ilia Mirkin imirkin at alum.mit.edu
Thu Nov 17 22:04:14 UTC 2016


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Thu, Nov 17, 2016 at 5:00 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> 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
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list