util: add util_copy_constant_buffer() helper function
authorBrian Paul <brianp@vmware.com>
Mon, 10 Dec 2012 19:29:08 +0000 (12:29 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 11 Dec 2012 19:48:06 +0000 (12:48 -0700)
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/util/u_inlines.h

index cb06ee2e096447795369668e9a698b03d2baa563..469f95461faffcb71adca91fd152ba0a1a45995b 100644 (file)
@@ -548,6 +548,26 @@ util_pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target,
    }
 }
 
+
+static INLINE void
+util_copy_constant_buffer(struct pipe_constant_buffer *dst,
+                          const struct pipe_constant_buffer *src)
+{
+   if (src) {
+      pipe_resource_reference(&dst->buffer, src->buffer);
+      dst->buffer_offset = src->buffer_offset;
+      dst->buffer_size = src->buffer_size;
+      dst->user_buffer = src->user_buffer;
+   }
+   else {
+      pipe_resource_reference(&dst->buffer, NULL);
+      dst->buffer_offset = 0;
+      dst->buffer_size = 0;
+      dst->user_buffer = NULL;
+   }
+}
+
+
 #ifdef __cplusplus
 }
 #endif