nvc0: reference the vertex buffers
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Mon, 27 Dec 2010 19:57:54 +0000 (20:57 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Mon, 27 Dec 2010 20:00:40 +0000 (21:00 +0100)
src/gallium/drivers/nvc0/nvc0_state.c

index e77e95625bc5f7825f3f38f02d8ce750f43d1109..5a9b1c2850995ba36297c0d03efc3acc94f4f90d 100644 (file)
@@ -771,6 +771,12 @@ nvc0_set_vertex_buffers(struct pipe_context *pipe,
                         const struct pipe_vertex_buffer *vb)
 {
     struct nvc0_context *nvc0 = nvc0_context(pipe);
+    unsigned i;
+
+    for (i = 0; i < count; ++i)
+       pipe_resource_reference(&nvc0->vtxbuf[i].buffer, vb[i].buffer);
+    for (; i < nvc0->num_vtxbufs; ++i)
+       pipe_resource_reference(&nvc0->vtxbuf[i].buffer, NULL);
 
     memcpy(nvc0->vtxbuf, vb, sizeof(*vb) * count);
     nvc0->num_vtxbufs = count;