[Mesa-dev] [PATCH 2/9] tgsi: fix tgsi transform's epilog callback

Roland Scheidegger sroland at vmware.com
Mon Sep 22 10:50:39 PDT 2014


Do you want to call it at (outermost) RET opcode (if any) instead?
tgsi is kinda undecided if there should be a ret opcode in main but
sometimes there is...

Roland

Am 22.09.2014 17:44, schrieb Brian Paul:
> We want to call the caller's epilog callback when we find the TGSI
> END instruction, not after it.
> ---
>  src/gallium/auxiliary/tgsi/tgsi_transform.c |   19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.c b/src/gallium/auxiliary/tgsi/tgsi_transform.c
> index 93e5b98..5a5f56c 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_transform.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_transform.c
> @@ -171,10 +171,19 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in,
>                 ctx->prolog(ctx);
>              }
>  
> -            if (ctx->transform_instruction)
> -               ctx->transform_instruction(ctx, fullinst);
> -            else
> +            if (fullinst->Instruction.Opcode == TGSI_OPCODE_END
> +                && ctx->epilog) {
> +               /* Emit caller's epilog */
> +               ctx->epilog(ctx);
> +               /* Emit END */
>                 ctx->emit_instruction(ctx, fullinst);
> +            }
> +            else {
> +               if (ctx->transform_instruction)
> +                  ctx->transform_instruction(ctx, fullinst);
> +               else
> +                  ctx->emit_instruction(ctx, fullinst);
> +            }
>  
>              first_instruction = FALSE;
>           }
> @@ -220,10 +229,6 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in,
>        }
>     }
>  
> -   if (ctx->epilog) {
> -      ctx->epilog(ctx);
> -   }
> -
>     tgsi_parse_free (&parse);
>  
>     return ctx->ti;
> 



More information about the mesa-dev mailing list