diff options
author | Chia-I Wu <[email protected]> | 2010-08-25 14:02:12 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2010-08-25 16:06:37 +0800 |
commit | 4f024e0f642f4f743e4d051ec71c00e45bfd361f (patch) | |
tree | 3d127b5d21ccfc9ebbf1a812540dcf95f088c70d /src/gallium/auxiliary/draw/draw_context.c | |
parent | 4e823197332604ca652ae6be21583725313f9f3d (diff) |
draw: Add draw_set_index_buffer and others.
This commit adds draw_set_index_buffer, draw_set_mapped_index_buffer,
and draw_vbo. The idea behind the new functions is that an index buffer
should be a state.
draw_arrays and draw_set_mapped_element_buffer are preserved, but the
latter will be removed soon.
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); } |