diff options
author | Marek Olšák <[email protected]> | 2011-11-20 03:36:49 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-11-20 16:24:11 +0100 |
commit | 4cfc8c775c751dd2b2b43f3ca58ae9798a84c0f1 (patch) | |
tree | 6f81be7fa60b9a562b540e422bba37946c491b04 /src/gallium/auxiliary | |
parent | b5b7cc19d82c8761a6b56268aecdccbc1ed2f911 (diff) |
u_vbuf_mgr: add set_index_buffer function
It will use the index buffer soon.
Diffstat (limited to 'src/gallium/auxiliary')
-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); |