summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_helpers.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-04-02 14:30:16 +0200
committerMarek Olšák <[email protected]>2017-05-10 19:00:16 +0200
commitc24c3b94ed29ecd99b1101c74c6c4606f9b5580e (patch)
tree81f6966bc59a68d9867693c65d35fae9bb1d9819 /src/gallium/auxiliary/util/u_helpers.c
parentfe437882ea2d60e91c244cc95beb4b79c615af49 (diff)
gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes
Diffstat (limited to 'src/gallium/auxiliary/util/u_helpers.c')
-rw-r--r--src/gallium/auxiliary/util/u_helpers.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/util/u_helpers.c b/src/gallium/auxiliary/util/u_helpers.c
index 5b46fa1351f..f91cb0c158d 100644
--- a/src/gallium/auxiliary/util/u_helpers.c
+++ b/src/gallium/auxiliary/util/u_helpers.c
@@ -51,10 +51,13 @@ void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst,
if (src) {
for (i = 0; i < count; i++) {
- if (src[i].buffer || src[i].user_buffer) {
+ if (src[i].buffer.resource)
bitmask |= 1 << i;
- }
- pipe_resource_reference(&dst[i].buffer, src[i].buffer);
+
+ pipe_vertex_buffer_unreference(&dst[i]);
+
+ if (!src[i].is_user_buffer)
+ pipe_resource_reference(&dst[i].buffer.resource, src[i].buffer.resource);
}
/* Copy over the other members of pipe_vertex_buffer. */
@@ -65,10 +68,8 @@ void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst,
}
else {
/* Unreference the buffers. */
- for (i = 0; i < count; i++) {
- pipe_resource_reference(&dst[i].buffer, NULL);
- dst[i].user_buffer = NULL;
- }
+ for (i = 0; i < count; i++)
+ pipe_vertex_buffer_unreference(&dst[i]);
*enabled_buffers &= ~(((1ull << count) - 1) << start_slot);
}
@@ -87,7 +88,7 @@ void util_set_vertex_buffers_count(struct pipe_vertex_buffer *dst,
uint32_t enabled_buffers = 0;
for (i = 0; i < *dst_count; i++) {
- if (dst[i].buffer || dst[i].user_buffer)
+ if (dst[i].buffer.resource)
enabled_buffers |= (1ull << i);
}