util: add util_copy_shader_buffer.
authorDave Airlie <airlied@redhat.com>
Wed, 26 Jun 2019 05:37:11 +0000 (15:37 +1000)
committerDave Airlie <airlied@redhat.com>
Sun, 7 Jul 2019 06:23:40 +0000 (16:23 +1000)
This just adds an inline to copy a pipe_shader_buffer.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/util/u_inlines.h

index 21b8c162b30cfb23f1a2e73dfc8fe389cf34fb8b..ffd0ea9c7a23f21d467302d506c19a141d9c97c5 100644 (file)
@@ -660,6 +660,22 @@ util_copy_constant_buffer(struct pipe_constant_buffer *dst,
    }
 }
 
+static inline void
+util_copy_shader_buffer(struct pipe_shader_buffer *dst,
+                        const struct pipe_shader_buffer *src)
+{
+   if (src) {
+      pipe_resource_reference(&dst->buffer, src->buffer);
+      dst->buffer_offset = src->buffer_offset;
+      dst->buffer_size = src->buffer_size;
+   }
+   else {
+      pipe_resource_reference(&dst->buffer, NULL);
+      dst->buffer_offset = 0;
+      dst->buffer_size = 0;
+   }
+}
+
 static inline void
 util_copy_image_view(struct pipe_image_view *dst,
                      const struct pipe_image_view *src)