summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-10-11 09:11:13 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-10-11 09:11:13 -0600
commit71efb6cf69724da2f1e783a13c3074d4e8645c64 (patch)
treecfab81d68ca7cfc539f6048339b7ddb43d3433e5 /src/mesa
parent98e638aa8df9f5b789b68a7a742666a4b06b6cb3 (diff)
clean-up, streamline st_draw_vbo()
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_draw.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 22f09c7a98..bfaa352fdc 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -197,6 +197,7 @@ st_draw_vbo(GLcontext *ctx,
GLuint max_index)
{
struct pipe_context *pipe = ctx->st->pipe;
+ struct pipe_winsys *winsys = pipe->winsys;
const struct st_vertex_program *vp;
const struct pipe_shader_state *vs;
const unsigned attr0_offset = (unsigned) arrays[0]->Ptr;
@@ -253,9 +254,9 @@ st_draw_vbo(GLcontext *ctx,
/* wrap user data */
vbuffer.buffer
- = pipe->winsys->user_buffer_create(pipe->winsys,
- (void *) arrays[mesaAttr]->Ptr,
- bytes);
+ = winsys->user_buffer_create(winsys,
+ (void *) arrays[mesaAttr]->Ptr,
+ bytes);
/* XXX need to deref/free this buffer.vbuffer after drawing! */
@@ -283,9 +284,8 @@ st_draw_vbo(GLcontext *ctx,
if (ib) {
/* indexed primitive */
struct gl_buffer_object *bufobj = ib->obj;
- struct pipe_buffer_handle *bh = NULL;
+ struct pipe_buffer_handle *indexBuf = NULL;
unsigned indexSize, i;
- GLboolean userBuffer = GL_FALSE;
switch (ib->type) {
case GL_UNSIGNED_INT:
@@ -298,28 +298,26 @@ st_draw_vbo(GLcontext *ctx,
assert(0);
}
+ /* get/create the index buffer object */
if (bufobj && bufobj->Name) {
/* elements/indexes are in a real VBO */
struct st_buffer_object *stobj = st_buffer_object(bufobj);
- bh = stobj->buffer;
- /* XXX reference buffer here, don't special case userBuffer below */
+ winsys->buffer_reference(winsys, &indexBuf, stobj->buffer);
}
else {
/* element/indicies are in user space memory */
- bh = pipe->winsys->user_buffer_create(pipe->winsys,
+ indexBuf = winsys->user_buffer_create(winsys,
(void *) ib->ptr,
ib->count * indexSize);
- userBuffer = GL_TRUE;
}
+ /* draw */
for (i = 0; i < nr_prims; i++) {
- pipe->draw_elements(pipe, bh, indexSize,
- prims[i].mode, prims[i].start, prims[i].count);
+ pipe->draw_elements(pipe, indexBuf, indexSize,
+ prims[i].mode, prims[i].start, prims[i].count);
}
- if (userBuffer) {
- pipe->winsys->buffer_reference(pipe->winsys, &bh, NULL);
- }
+ winsys->buffer_reference(winsys, &indexBuf, NULL);
}
else {
/* non-indexed */