On 13.07.2017 22:38, Marek Olšák wrote:
From: Marek Olšák <marek.ol...@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.haeh...@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.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to