From 3c9aa3a7b12cfe178c14fea93cfb64a32db0b8ad Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 26 Dec 2010 18:43:39 +0100 Subject: gallium: drivers should reference vertex buffers So that a state tracker can unreference them after set_vertex_buffers. --- src/gallium/auxiliary/util/u_inlines.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/gallium/auxiliary/util/u_inlines.h') diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 9184b6aa4d..8aaf7a7416 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -400,6 +400,24 @@ static INLINE boolean util_get_offset( } } +static INLINE void util_copy_vertex_buffers(struct pipe_vertex_buffer *dst, + unsigned *dst_count, + const struct pipe_vertex_buffer *src, + unsigned src_count) +{ + unsigned i; + + for (i = 0; i < src_count; i++) { + pipe_resource_reference(&dst[i].buffer, src[i].buffer); + } + for (; i < *dst_count; i++) { + pipe_resource_reference(&dst[i].buffer, NULL); + } + + *dst_count = src_count; + memcpy(dst, src, src_count * sizeof(struct pipe_vertex_buffer)); +} + #ifdef __cplusplus } #endif -- cgit v1.2.3