summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_inlines.h
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2011-01-06 00:26:02 +0100
committerMarek Olšák <maraeo@gmail.com>2011-01-06 16:16:30 +0100
commit45b51a9e7021c004c754e1903afeb15fd885109e (patch)
tree714b1ffdf92fbf751997dbb0a1088c35c18f2235 /src/gallium/auxiliary/util/u_inlines.h
parent984d64881fbdd6524bbd4f78ef7f9daaa6c5567b (diff)
util: add comments to u_upload_mgr and u_inlines
Diffstat (limited to 'src/gallium/auxiliary/util/u_inlines.h')
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 8aaf7a7416..b4870bce98 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -400,6 +400,12 @@ static INLINE boolean util_get_offset(
}
}
+/**
+ * This function is used to copy an array of pipe_vertex_buffer structures,
+ * while properly referencing the pipe_vertex_buffer::buffer member.
+ *
+ * \sa util_copy_framebuffer_state
+ */
static INLINE void util_copy_vertex_buffers(struct pipe_vertex_buffer *dst,
unsigned *dst_count,
const struct pipe_vertex_buffer *src,
@@ -407,13 +413,17 @@ static INLINE void util_copy_vertex_buffers(struct pipe_vertex_buffer *dst,
{
unsigned i;
+ /* Reference the buffers of 'src' in 'dst'. */
for (i = 0; i < src_count; i++) {
pipe_resource_reference(&dst[i].buffer, src[i].buffer);
}
+ /* Unreference the rest of the buffers in 'dst'. */
for (; i < *dst_count; i++) {
pipe_resource_reference(&dst[i].buffer, NULL);
}
+ /* Update the size of 'dst' and copy over the other members
+ * of pipe_vertex_buffer. */
*dst_count = src_count;
memcpy(dst, src, src_count * sizeof(struct pipe_vertex_buffer));
}