summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_surface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/util/u_surface.c')
-rw-r--r--src/gallium/auxiliary/util/u_surface.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index 9caf76c802b..4c5cc4da182 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;
@@ -188,15 +191,19 @@ util_resource_copy_region(struct pipe_context *pipe,
assert(dst_map);
if (src_map && dst_map) {
- util_copy_rect(dst_map,
- dst_format,
- dst_trans->stride,
- 0, 0,
- w, h,
- src_map,
- src_trans->stride,
- 0,
- 0);
+ if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
+ memcpy(dst_map, src_map, w);
+ } else {
+ util_copy_rect(dst_map,
+ dst_format,
+ dst_trans->stride,
+ 0, 0,
+ w, h,
+ src_map,
+ src_trans->stride,
+ 0,
+ 0);
+ }
}
pipe->transfer_unmap(pipe, src_trans);