summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-12-10 12:29:08 -0700
committerBrian Paul <[email protected]>2012-12-11 12:48:06 -0700
commit4c6053dc519aecd93c12c383b4cdc0c159b3d9b3 (patch)
treece46d5f2e9d77c1ac960f3966f114244fce1d599 /src/gallium/auxiliary/util
parentbeafced21c3c11315a8b94f20508562729453175 (diff)
util: add util_copy_constant_buffer() helper function
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index cb06ee2e096..469f95461fa 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -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