[PATCH] u_blitter: fix format compatibility assertion

Christoph Bumiller e0425955 at student.tuwien.ac.at
Wed Dec 15 12:29:38 PST 2010


The description of util_blitter_copy_region promises that format
conversion will be done if it is possible.
The assertion only applies if resource_copy_region must be used.
---
 src/gallium/auxiliary/util/u_blitter.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 4c986e3..dc411ab 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -727,6 +727,7 @@ void util_blitter_copy_region(struct blitter_context *blitter,
    unsigned height = srcbox->height;
    boolean is_stencil, is_depth;
    boolean normalized;
+   boolean compatible;
 
    /* Give up if textures are not set. */
    assert(dst && src);
@@ -735,11 +736,13 @@ void util_blitter_copy_region(struct blitter_context *blitter,
 
    /* Sanity checks. */
    if (dst == src) {
+      compatible = TRUE;
       assert(!is_overlap(srcbox->x, srcbox->x + width, srcbox->y, srcbox->y + height,
                          dstx, dstx + width, dsty, dsty + height));
    } else {
-      assert(util_is_format_compatible(util_format_description(dst->format),
-                                       util_format_description(src->format)));
+      compatible =
+         util_is_format_compatible(util_format_description(src->format),
+                                   util_format_description(dst->format));
    }
    assert(src->target < PIPE_MAX_TEXTURE_TYPES);
    /* XXX should handle 3d regions */
@@ -757,13 +760,15 @@ void util_blitter_copy_region(struct blitter_context *blitter,
    /* Check if we can sample from and render to the surfaces. */
    /* (assuming copying a stencil buffer is not possible) */
     if ((!ignore_stencil && is_stencil) ||
+        compatible ||
        !screen->is_format_supported(screen, dst->format, dst->target,
                                     dst->nr_samples, bind, 0) ||
        !screen->is_format_supported(screen, src->format, src->target,
                                     src->nr_samples, PIPE_BIND_SAMPLER_VIEW, 0)) {
-      util_resource_copy_region(pipe, dst, dstlevel, dstx, dsty, dstz,
-                                src, srclevel, srcbox);
-      return;
+       assert(compatible);
+       util_resource_copy_region(pipe, dst, dstlevel, dstx, dsty, dstz,
+                                 src, srclevel, srcbox);
+       return;
    }
 
    /* Get surface. */
-- 
1.7.2.2


--------------050605050300030009040702--


More information about the mesa-dev mailing list