diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/util/u_vbuf_mgr.c | 13 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_vbuf_mgr.h | 5 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf_mgr.c b/src/gallium/auxiliary/util/u_vbuf_mgr.c index 5d3f137ecb3..15cdfaead2a 100644 --- a/src/gallium/auxiliary/util/u_vbuf_mgr.c +++ b/src/gallium/auxiliary/util/u_vbuf_mgr.c @@ -520,6 +520,19 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf_mgr *mgrb, mgr->b.nr_real_vertex_buffers = count; } +void u_vbuf_set_index_buffer(struct u_vbuf_mgr *mgr, + const struct pipe_index_buffer *ib) +{ + if (ib && ib->buffer) { + assert(ib->offset % ib->index_size == 0); + pipe_resource_reference(&mgr->index_buffer.buffer, ib->buffer); + mgr->index_buffer.offset = ib->offset; + mgr->index_buffer.index_size = ib->index_size; + } else { + pipe_resource_reference(&mgr->index_buffer.buffer, NULL); + } +} + static void u_vbuf_upload_buffers(struct u_vbuf_priv *mgr, int min_index, int max_index, diff --git a/src/gallium/auxiliary/util/u_vbuf_mgr.h b/src/gallium/auxiliary/util/u_vbuf_mgr.h index d854e4449b3..8d39db34677 100644 --- a/src/gallium/auxiliary/util/u_vbuf_mgr.h +++ b/src/gallium/auxiliary/util/u_vbuf_mgr.h @@ -69,6 +69,8 @@ struct u_vbuf_mgr { /* Precomputed max_index for hardware vertex buffers. */ unsigned max_index; + /* The index buffer. */ + struct pipe_index_buffer index_buffer; /* This uploader can optionally be used by the driver. * @@ -126,6 +128,9 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf_mgr *mgr, unsigned count, const struct pipe_vertex_buffer *bufs); +void u_vbuf_set_index_buffer(struct u_vbuf_mgr *mgr, + const struct pipe_index_buffer *ib); + enum u_vbuf_return_flags u_vbuf_draw_begin(struct u_vbuf_mgr *mgr, const struct pipe_draw_info *info); |