diff options
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_context.c')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_context.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index d118a8db52d..c2b7a441bd7 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -496,6 +496,27 @@ void draw_set_render( struct draw_context *draw, } +void +draw_set_index_buffer(struct draw_context *draw, + const struct pipe_index_buffer *ib) +{ + if (ib) + memcpy(&draw->pt.index_buffer, ib, sizeof(draw->pt.index_buffer)); + else + memset(&draw->pt.index_buffer, 0, sizeof(draw->pt.index_buffer)); +} + + +/** + * Tell drawing context where to find mapped index/element buffer. + */ +void +draw_set_mapped_index_buffer(struct draw_context *draw, + const void *elements) +{ + draw->pt.user.elts = elements; +} + /** * Tell the drawing context about the index/element buffer to use @@ -515,8 +536,13 @@ draw_set_mapped_element_buffer_range( struct draw_context *draw, unsigned max_index, const void *elements ) { + struct pipe_index_buffer ib; + + memset(&ib, 0, sizeof(ib)); + ib.index_size = eltSize; + draw_set_index_buffer(draw, &ib); + draw->pt.user.elts = elements; - draw->pt.user.eltSize = eltSize; draw->pt.user.eltBias = eltBias; draw->pt.user.min_index = min_index; draw->pt.user.max_index = max_index; @@ -529,11 +555,8 @@ draw_set_mapped_element_buffer( struct draw_context *draw, int eltBias, const void *elements ) { - draw->pt.user.elts = elements; - draw->pt.user.eltSize = eltSize; - draw->pt.user.eltBias = eltBias; - draw->pt.user.min_index = 0; - draw->pt.user.max_index = 0xffffffff; + draw_set_mapped_element_buffer_range(draw, + eltSize, eltBias, 0, 0xffffffff, elements); } |