summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_draw.c
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2009-03-04 11:58:48 +0100
committerMichel Dänzer <[email protected]>2009-03-04 11:58:48 +0100
commit5e27cd46c04a9e7b5904cc014bffd0f4daae31fe (patch)
treea57289f14d69f1977dfaee592af908052d726b8c /src/mesa/state_tracker/st_draw.c
parent60041203d5847de8ab71842a6ce5d33d96cc4930 (diff)
gallium: Unify reference counting.
The core reference counting code is centralized in p_refcnt.h. This has some consequences related to struct pipe_buffer: * The screen member of struct pipe_buffer must be initialized, or pipe_buffer_reference() will crash trying to destroy a buffer with reference count 0. u_simple_screen takes care of this, but I may have missed some of the drivers not using it. * Except for rare exceptions deep in winsys code, buffers must always be allocated via pipe_buffer_create() or via screen->*buffer_create() rather than via winsys->*buffer_create().
Diffstat (limited to 'src/mesa/state_tracker/st_draw.c')
-rw-r--r--src/mesa/state_tracker/st_draw.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index b52e4886128..be1d9a86281 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -378,7 +378,7 @@ setup_interleaved_attribs(GLcontext *ctx,
}
else {
vbuffer->buffer = NULL;
- pipe_buffer_reference(pipe->screen, &vbuffer->buffer, stobj->buffer);
+ pipe_buffer_reference(&vbuffer->buffer, stobj->buffer);
vbuffer->buffer_offset = (unsigned) low;
}
vbuffer->stride = stride; /* in bytes */
@@ -433,7 +433,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
/*printf("stobj %u = %p\n", attr, (void*) stobj);*/
vbuffer[attr].buffer = NULL;
- pipe_buffer_reference(pipe->screen, &vbuffer[attr].buffer, stobj->buffer);
+ pipe_buffer_reference(&vbuffer[attr].buffer, stobj->buffer);
vbuffer[attr].buffer_offset = (unsigned) arrays[mesaAttr]->Ptr;
velements[attr].src_offset = 0;
}
@@ -617,7 +617,7 @@ st_draw_vbo(GLcontext *ctx,
if (bufobj && bufobj->Name) {
/* elements/indexes are in a real VBO */
struct st_buffer_object *stobj = st_buffer_object(bufobj);
- pipe_buffer_reference(pipe->screen, &indexBuf, stobj->buffer);
+ pipe_buffer_reference(&indexBuf, stobj->buffer);
indexOffset = (unsigned) ib->ptr / indexSize;
}
else {
@@ -657,7 +657,7 @@ st_draw_vbo(GLcontext *ctx,
}
}
- pipe_buffer_reference(pipe->screen, &indexBuf, NULL);
+ pipe_buffer_reference(&indexBuf, NULL);
}
else {
/* non-indexed */
@@ -673,7 +673,7 @@ 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);
+ pipe_buffer_reference(&vbuffer[attr].buffer, NULL);
assert(!vbuffer[attr].buffer);
}