[Mesa-dev] [PATCH 2/7] tgsi/transform: add support for SVIEW decls

Brian Paul brianp at vmware.com
Thu Jun 11 07:41:41 PDT 2015


On 06/10/2015 06:14 PM, Rob Clark wrote:
> From: Rob Clark <robclark at freedesktop.org>
>
> Signed-off-by: Rob Clark <robclark at freedesktop.org>
> ---
>   src/gallium/auxiliary/tgsi/tgsi_transform.h | 24 ++++++++++++++++++++++++
>   1 file changed, 24 insertions(+)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.h b/src/gallium/auxiliary/tgsi/tgsi_transform.h
> index 921aa906..e7de49e 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_transform.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_transform.h
> @@ -143,6 +143,30 @@ tgsi_transform_sampler_decl(struct tgsi_transform_context *ctx,
>      ctx->emit_declaration(ctx, &decl);
>   }
>
> +static INLINE void
> +tgsi_transform_sampler_view_decl(struct tgsi_transform_context *ctx,
> +                                 unsigned index,
> +                                 unsigned target,
> +                                 unsigned return_type_x,
> +                                 unsigned return_type_y,
> +                                 unsigned return_type_z,
> +                                 unsigned return_type_w)

I think you can get by with just one return_type parameter since all 
callers seem to pass the same value for x/y/z/w.

Also, the param type should be enum tgsi_return_type instead of unsigned.


> +{
> +   struct tgsi_full_declaration decl;
> +
> +   decl = tgsi_default_full_declaration();
> +   decl.Declaration.File = TGSI_FILE_SAMPLER_VIEW;
> +   decl.Declaration.UsageMask = 0xf;
> +   decl.Range.First =
> +   decl.Range.Last = index;
> +   decl.SamplerView.Resource = target;
> +   decl.SamplerView.ReturnTypeX = return_type_x;
> +   decl.SamplerView.ReturnTypeY = return_type_y;
> +   decl.SamplerView.ReturnTypeZ = return_type_z;
> +   decl.SamplerView.ReturnTypeW = return_type_w;
> +
> +   ctx->emit_declaration(ctx, &decl);
> +}
>
>   static INLINE void
>   tgsi_transform_immediate_decl(struct tgsi_transform_context *ctx,
>



More information about the mesa-dev mailing list