Revert "st/mesa: don't unreference user attribs up front."
authorBrian Paul <brianp@vmware.com>
Thu, 1 Mar 2012 14:20:16 +0000 (07:20 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 1 Mar 2012 15:55:24 +0000 (08:55 -0700)
This reverts commit 72931ca4b9fb1002f5b62b74f7f7f32e94e80fde.

This commit caused a few piglit regressions (quad-invariance, draw-batch,
etc) with the vmware svga driver.

src/mesa/state_tracker/st_draw.c

index e4bc36ed5f8d2c3f048f592ed9ad2eb4ae0b3572..eb187519ffe6aab093179c8c05d85c342dcf2ce5 100644 (file)
@@ -905,7 +905,6 @@ st_validate_varrays(struct gl_context *ctx,
    unsigned num_vbuffers, num_velements;
    GLuint attr;
    unsigned i;
-   unsigned old_num_user_attribs;
 
    /* must get these after state validation! */
    vp = st->vp;
@@ -914,7 +913,9 @@ st_validate_varrays(struct gl_context *ctx,
    memset(velements, 0, sizeof(struct pipe_vertex_element) * vpv->num_inputs);
 
    /* Unreference any user vertex buffers. */
-   old_num_user_attribs = st->num_user_attribs;
+   for (i = 0; i < st->num_user_attribs; i++) {
+      pipe_resource_reference(&st->user_attrib[i].buffer, NULL);
+   }
    st->num_user_attribs = 0;
 
    /*
@@ -953,10 +954,6 @@ st_validate_varrays(struct gl_context *ctx,
       assert(!vbuffer[attr].buffer);
    }
 
-   for (i = old_num_user_attribs; i < st->num_user_attribs; i++) {
-      pipe_resource_reference(&st->user_attrib[i].buffer, NULL);
-   }
-
    return GL_TRUE;
 }