Mesa (master): gallium/u_inlines: add helper for simplifying pipe_context::resource_copy_region

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jan 23 00:21:33 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Sep  9 14:35:23 2020 -0400

gallium/u_inlines: add helper for simplifying pipe_context::resource_copy_region

this hook has too many params, and I only need like half of them

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8624>

---

 src/gallium/auxiliary/util/u_inlines.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index c5aadc7ca18..3663629d4d9 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -427,6 +427,23 @@ pipe_buffer_write_nooverlap(struct pipe_context *pipe,
                         offset, size, data);
 }
 
+/**
+ * Utility for simplifying pipe_context::resource_copy_region calls
+ */
+static inline void
+pipe_buffer_copy(struct pipe_context *pipe,
+                 struct pipe_resource *dst,
+                 struct pipe_resource *src,
+                 unsigned dst_offset,
+                 unsigned src_offset,
+                 unsigned size)
+{
+   struct pipe_box box;
+   /* only these fields are used */
+   box.x = (int)src_offset;
+   box.width = (int)size;
+   pipe->resource_copy_region(pipe, dst, 0, dst_offset, 0, 0, src, 0, &box);
+}
 
 /**
  * Create a new resource and immediately put data into it



More information about the mesa-commit mailing list