OK, here's the patch:

    galahad,util: warn on resource target mismatch in copy_region

diff --git a/src/gallium/auxiliary/util/u_surface.c
b/src/gallium/auxiliary/util/u_surfac
index 43a0266..4c5cc4d 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -157,6 +157,9 @@ util_resource_copy_region(struct pipe_context *pipe,
    unsigned h = src_box->height;

    assert(src && dst);
+   assert((src->target == PIPE_BUFFER && dst->target == PIPE_BUFFER) ||
+          (src->target != PIPE_BUFFER && dst->target != PIPE_BUFFER));
+
    if (!src || !dst)
       return;

diff --git a/src/gallium/drivers/galahad/glhd_context.c
b/src/gallium/drivers/galahad/glh
index 813a21e..f73d8a5 100644
--- a/src/gallium/drivers/galahad/glhd_context.c
+++ b/src/gallium/drivers/galahad/glhd_context.c
@@ -685,6 +685,12 @@ galahad_resource_copy_region(struct pipe_context
*_pipe,
          util_format_short_name(_dst->format));
    }

+   if ((_src->target == PIPE_BUFFER && _dst->target != PIPE_BUFFER) ||
+       (_src->target != PIPE_BUFFER && _dst->target == PIPE_BUFFER)) {
+      glhd_warn("Resource target mismatch: Source is %i, destination is
%i",
+                _src->target, _dst->target);
+   }
+
    pipe->resource_copy_region(pipe,
                               dst,
                               dst_level,

Marek

On Thu, Apr 21, 2011 at 2:53 PM, Jakob Bornecrantz <wallbra...@gmail.com>wrote:

> On Thu, Apr 21, 2011 at 2:47 PM, Marek Olšák <mar...@gmail.com> wrote:
> > On Thu, Apr 21, 2011 at 1:19 PM, Jakob Bornecrantz <wallbra...@gmail.com
> >
> > wrote:
> >>
> >> On Thu, Apr 21, 2011 at 1:11 PM, Marek Olšák <mar...@gmail.com> wrote:
> >> > Hi,
> >> >
> >> > This little series implements CopyBufferSubData via
> resource_copy_region
> >> > and adds a fallback implementation to all drivers. Now drivers can
> implement
> >> > a fast path for CopyBufferSubData instead of always defaulting to the
> >> > software path.
> >> >
> >> > I have tested this series with glean/bufferObject on r600g, softpipe,
> >> > and llvmpipe. Please review.
> >>
> >> I'm assuming that it is not allowed to copy_region between buffers and
> >> none buffers? Maybe some asserts to that effect?
> >
> > In util_resource_copy_region? Or in all the drivers? Or just Galahad?
>
> util_resource_copy_region and Galahad, drivers are free to assert if
> they want to but its not something you need to add.
>
> Cheers Jakob.
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to