diff options
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r-- | src/gallium/auxiliary/util/u_helpers.c | 15 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_helpers.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_helpers.c b/src/gallium/auxiliary/util/u_helpers.c index ac1edcdbb82..09619c1c9e9 100644 --- a/src/gallium/auxiliary/util/u_helpers.c +++ b/src/gallium/auxiliary/util/u_helpers.c @@ -88,3 +88,18 @@ void util_set_vertex_buffers_count(struct pipe_vertex_buffer *dst, *dst_count = util_last_bit(enabled_buffers); } + + +void +util_set_index_buffer(struct pipe_index_buffer *dst, + const struct pipe_index_buffer *src) +{ + if (src) { + pipe_resource_reference(&dst->buffer, src->buffer); + memcpy(dst, src, sizeof(*dst)); + } + else { + pipe_resource_reference(&dst->buffer, NULL); + memset(dst, 0, sizeof(*dst)); + } +} diff --git a/src/gallium/auxiliary/util/u_helpers.h b/src/gallium/auxiliary/util/u_helpers.h index 09c7116fa6d..f25f2807fe5 100644 --- a/src/gallium/auxiliary/util/u_helpers.h +++ b/src/gallium/auxiliary/util/u_helpers.h @@ -44,6 +44,9 @@ void util_set_vertex_buffers_count(struct pipe_vertex_buffer *dst, const struct pipe_vertex_buffer *src, unsigned start_slot, unsigned count); +void util_set_index_buffer(struct pipe_index_buffer *dst, + const struct pipe_index_buffer *src); + #ifdef __cplusplus } #endif |