mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 05:08:08 +02:00
util: added util_set_index_buffer()
Like util_set_vertex_buffers_count(), this basically just copies a pipe_index_buffer object, taking care of refcounting.
This commit is contained in:
parent
47b4efc710
commit
84dad65088
2 changed files with 18 additions and 0 deletions
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue