[Mesa-dev] [PATCH] gallium/u_blitter: don't use TXF for scaled blits

Nicolai Hähnle nhaehnle at gmail.com
Sun Jul 16 10:06:59 UTC 2017


On 13.07.2017 22:38, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> There seems to be a rounding difference with F2I vs nearest filtering.
> The precise problem in the rounding is unknown.
> 
> This fixes an incorrect output with OpenMAX encoding.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>


> ---
>   src/gallium/auxiliary/util/u_blitter.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
> index c38534d..65c6f5d 100644
> --- a/src/gallium/auxiliary/util/u_blitter.c
> +++ b/src/gallium/auxiliary/util/u_blitter.c
> @@ -1770,29 +1770,31 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
>   
>      blit_color = has_color && (mask & PIPE_MASK_RGBA);
>      blit_depth = has_depth && (mask & PIPE_MASK_Z);
>      blit_stencil = has_stencil && (mask & PIPE_MASK_S) &&
>                     ctx->has_stencil_export;
>   
>      if (!blit_stencil && !blit_depth && !blit_color) {
>         return;
>      }
>   
> -   if (blit_stencil ||
> -       (dstbox->width == abs(srcbox->width) &&
> -        dstbox->height == abs(srcbox->height))) {
> +   bool is_scaled = dstbox->width != abs(srcbox->width) ||
> +                    dstbox->height != abs(srcbox->height);
> +
> +   if (blit_stencil || !is_scaled)
>         filter = PIPE_TEX_FILTER_NEAREST;
> -   }
>   
>      bool use_txf = false;
>   
> +   /* Don't support scaled blits. The TXF shader uses F2I for rounding. */
>      if (ctx->has_txf &&
> +       !is_scaled &&
>          filter == PIPE_TEX_FILTER_NEAREST &&
>          src->target != PIPE_TEXTURE_CUBE &&
>          src->target != PIPE_TEXTURE_CUBE_ARRAY) {
>         int src_width = u_minify(src_width0, src->u.tex.first_level);
>         int src_height = u_minify(src_height0, src->u.tex.first_level);
>         int src_depth = src->u.tex.last_layer + 1;
>         struct pipe_box box = *srcbox;
>   
>         /* Eliminate negative width/height/depth. */
>         if (box.width < 0) {
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list