[Mesa-dev] [PATCH 2/3] softpipe: add get_dims callback for TXQ support. (v2)

Brian Paul brianp at vmware.com
Thu Aug 25 07:56:11 PDT 2011


For the series, Reviewed-by: Brian Paul <brianp at vmware.com>

Just one nit below...


On 08/25/2011 08:46 AM, Dave Airlie wrote:
> From: Dave Airlie<airlied at redhat.com>
>
> This adds the get_dims callback that is called from the tgsi exec_txq.
>
> It returns values as per EXT_gpu_program4.
>
> v2: fix one indent + use a switch (slighty modified from Brian)
>
> Signed-off-by: Dave Airlie<airlied at redhat.com>
> ---
>   src/gallium/drivers/softpipe/sp_tex_sample.c |   38 ++++++++++++++++++++++++++
>   1 files changed, 38 insertions(+), 0 deletions(-)
>
> diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
> index f730948..93925f9 100644
> --- a/src/gallium/drivers/softpipe/sp_tex_sample.c
> +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
> @@ -2566,6 +2566,43 @@ sp_sampler_variant_destroy( struct sp_sampler_variant *samp )
>      FREE(samp);
>   }
>
> +static void
> +sample_get_dims(struct tgsi_sampler *tgsi_sampler, int level,
> +		int dims[4])
> +{
> +    struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler);
> +    const struct pipe_sampler_view *view = samp->view;
> +    const struct pipe_resource *texture = view->texture;
> +
> +    /* undefined according to EXT_gpu_program */
> +    level += view->u.tex.first_level;
> +    if (level>  view->u.tex.last_level)
> +	return;
> +
> +    dims[0] = u_minify(texture->width0, level);
> +
> +    switch(texture->target) {
> +    case PIPE_TEXTURE_1D_ARRAY: /* fallthrough */
> +       dims[1] = texture->array_size;
> +    case PIPE_TEXTURE_1D:
> +    case PIPE_BUFFER:
> +       return;
> +    case PIPE_TEXTURE_2D_ARRAY:
> +       dims[2] = texture->array_size; /* fallthrough */
> +    case PIPE_TEXTURE_2D:
> +    case PIPE_TEXTURE_CUBE:
> +    case PIPE_TEXTURE_RECT:

The /* fallthrough */ comments aren't consistently placed.  I'd put 
them where the break would normally be seen:

     switch(texture->target) {
     case PIPE_TEXTURE_1D_ARRAY:
        dims[1] = texture->array_size;
        /* fallthrough */


-Brian


More information about the mesa-dev mailing list