Mesa (master): util: add a simple memcpy path for copying buffers in util_resource_copy_region

Marek Olšák mareko at kemper.freedesktop.org
Thu Apr 21 06:53:02 PDT 2011


Module: Mesa
Branch: master
Commit: 64f55216e4c11e8acb787bfe40e6dd25e862cd43
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=64f55216e4c11e8acb787bfe40e6dd25e862cd43

Author: Marek Olšák <maraeo at gmail.com>
Date:   Thu Apr 21 12:50:00 2011 +0200

util: add a simple memcpy path for copying buffers in util_resource_copy_region

Reviewed-by: Jakob Bornecrantz <jakob at vmware.com>

---

 src/gallium/auxiliary/util/u_surface.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index 9caf76c..43a0266 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -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);



More information about the mesa-commit mailing list