aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2008-12-10 15:43:21 +0000
committerKeith Whitwell <[email protected]>2008-12-11 14:02:10 +0000
commit72d456494a7074f11ab9c735d0caeae4e09a33e7 (patch)
tree3a24f647c5bca8cea4a90d75c9467c19ba654830 /src
parente8347a6000339e2f7bd086abc0a5daa3bbd1bc44 (diff)
st: reduce unnecessary calls to pipe->set_vertex_buffers()
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_draw.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 8f27076848a..3229e932484 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -409,6 +409,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
const struct st_vertex_program *vp,
const struct gl_client_array **arrays,
GLuint max_index,
+ GLboolean *userSpace,
struct pipe_vertex_buffer vbuffer[],
struct pipe_vertex_element velements[])
{
@@ -420,6 +421,8 @@ setup_non_interleaved_attribs(GLcontext *ctx,
struct gl_buffer_object *bufobj = arrays[mesaAttr]->BufferObj;
GLsizei stride = arrays[mesaAttr]->StrideB;
+ *userSpace = GL_FALSE;
+
if (bufobj && bufobj->Name) {
/* Attribute data is in a VBO.
* Recall that for VBOs, the gl_client_array->Ptr field is
@@ -439,6 +442,8 @@ setup_non_interleaved_attribs(GLcontext *ctx,
uint bytes;
/*printf("user-space array %d stride %d\n", attr, stride);*/
+ *userSpace = GL_TRUE;
+
/* wrap user data */
if (arrays[mesaAttr]->Ptr) {
/* user's vertex array */
@@ -555,7 +560,7 @@ st_draw_vbo(GLcontext *ctx,
else {
/*printf("Draw non-interleaved\n");*/
setup_non_interleaved_attribs(ctx, vp, arrays, max_index,
- vbuffer, velements);
+ &userSpace, vbuffer, velements);
num_vbuffers = vp->num_inputs;
num_velements = vp->num_inputs;
}
@@ -665,13 +670,17 @@ st_draw_vbo(GLcontext *ctx,
}
/* unreference buffers (frees wrapped user-space buffer objects) */
- for (attr = 0; attr < num_vbuffers; attr++) {
- pipe_buffer_reference(pipe->screen, &vbuffer[attr].buffer, NULL);
- assert(!vbuffer[attr].buffer);
+ if (userSpace)
+ {
+ for (attr = 0; attr < num_vbuffers; attr++) {
+ pipe_buffer_reference(pipe->screen, &vbuffer[attr].buffer, NULL);
+ assert(!vbuffer[attr].buffer);
+ }
+ pipe->set_vertex_buffers(pipe, 0, NULL);
}
- pipe->set_vertex_buffers(pipe, num_vbuffers, vbuffer);
}
+
void st_init_draw( struct st_context *st )
{
GLcontext *ctx = st->ctx;