[Mesa-dev] [PATCH] gallium/u_blitter: fix is_blit_generic_supported() stencil checking

Jose Fonseca jfonseca at vmware.com
Fri Apr 5 10:32:06 PDT 2013



----- Original Message -----
> Don't check if there's sampler support for stencil if we're not
> going to actually blit/copy stencil values.  Fixes the case where
> we mistakenly said we can't support a blit of depth values from
> S8Z24 to X8Z24.
> 
> Also, rename the is_stencil variable to dst_has_stencil to improve
> readability.
> 
> NOTE: This is a candidate for the stable branches.
> ---
>  src/gallium/auxiliary/util/u_blitter.c |   28 +++++++++++++++-------------
>  1 files changed, 15 insertions(+), 13 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_blitter.c
> b/src/gallium/auxiliary/util/u_blitter.c
> index 70fec91..2a4a13e 100644
> --- a/src/gallium/auxiliary/util/u_blitter.c
> +++ b/src/gallium/auxiliary/util/u_blitter.c
> @@ -1135,18 +1135,17 @@ static boolean is_blit_generic_supported(struct
> blitter_context *blitter,
>  
>     if (dst) {
>        unsigned bind;
> -      boolean is_stencil;
>        const struct util_format_description *desc =
>              util_format_description(dst_format);
> -
> -      is_stencil = util_format_has_stencil(desc);
> +      boolean dst_has_stencil = util_format_has_stencil(desc);
>  
>        /* Stencil export must be supported for stencil copy. */
> -      if ((mask & PIPE_MASK_S) && is_stencil && !ctx->has_stencil_export) {
> +      if ((mask & PIPE_MASK_S) && dst_has_stencil &&
> +          !ctx->has_stencil_export) {
>           return FALSE;
>        }
>  
> -      if (is_stencil || util_format_has_depth(desc))
> +      if (dst_has_stencil || util_format_has_depth(desc))
>           bind = PIPE_BIND_DEPTH_STENCIL;
>        else
>           bind = PIPE_BIND_RENDER_TARGET;
> @@ -1168,15 +1167,18 @@ static boolean is_blit_generic_supported(struct
> blitter_context *blitter,
>        }
>  
>        /* Check stencil sampler support for stencil copy. */
> -      if (util_format_has_stencil(util_format_description(src_format))) {
> -         enum pipe_format stencil_format =
> +      if (mask & PIPE_MASK_S) {
> +         if (util_format_has_stencil(util_format_description(src_format))) {
> +            enum pipe_format stencil_format =
>                 util_format_stencil_only(src_format);
> -         assert(stencil_format != PIPE_FORMAT_NONE);
> +            assert(stencil_format != PIPE_FORMAT_NONE);
>  
> -         if (stencil_format != src_format &&
> -             !screen->is_format_supported(screen, stencil_format,
> src->target,
> -                                 src->nr_samples, PIPE_BIND_SAMPLER_VIEW)) {
> -            return FALSE;
> +            if (stencil_format != src_format &&
> +                !screen->is_format_supported(screen, stencil_format,
> +                                             src->target, src->nr_samples,
> +                                             PIPE_BIND_SAMPLER_VIEW)) {
> +               return FALSE;
> +            }
>           }
>        }
>     }
> --
> 1.7.3.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 

Looks good to me.

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>


More information about the mesa-dev mailing list