[Mesa-dev] [PATCH 08/10] gallium/util: add util_copy_vertex_buffer helper

Rob Clark robdclark at gmail.com
Tue Jun 14 15:58:00 UTC 2016


From: Rob Clark <robclark at freedesktop.org>

Signed-off-by: Rob Clark <robclark at freedesktop.org>
---
 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 ebaf368..93171d9 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -671,6 +671,23 @@ util_copy_image_view(struct pipe_image_view *dst,
    }
 }
 
+static inline void
+util_copy_vertex_buffer(struct pipe_vertex_buffer *dst,
+                        const struct pipe_vertex_buffer *src)
+{
+   if (src) {
+      dst->stride = src->stride;
+      dst->buffer_offset = src->buffer_offset;
+      pipe_resource_reference(&dst->buffer, src->buffer);
+      dst->user_buffer = src->user_buffer;
+   } else {
+      dst->stride = 0;
+      dst->buffer_offset = 0;
+      pipe_resource_reference(&dst->buffer, NULL);
+      dst->user_buffer = NULL;
+   }
+}
+
 static inline unsigned
 util_max_layer(const struct pipe_resource *r, unsigned level)
 {
-- 
2.5.5



More information about the mesa-dev mailing list