util: add a simple memcpy path for copying buffers in util_resource_copy_region
authorMarek Olšák <maraeo@gmail.com>
Thu, 21 Apr 2011 10:50:00 +0000 (12:50 +0200)
committerMarek Olšák <maraeo@gmail.com>
Thu, 21 Apr 2011 13:51:18 +0000 (15:51 +0200)
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
src/gallium/auxiliary/util/u_surface.c

index 9caf76c802b6986524185f6f29f75494f3e0d9dd..43a026691d37bac01d74fd9dc4c8ca425559ca56 100644 (file)
@@ -188,15 +188,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);