diff options
author | Michel Dänzer <[email protected]> | 2009-03-04 11:58:48 +0100 |
---|---|---|
committer | Michel Dänzer <[email protected]> | 2009-03-04 11:58:48 +0100 |
commit | 5e27cd46c04a9e7b5904cc014bffd0f4daae31fe (patch) | |
tree | a57289f14d69f1977dfaee592af908052d726b8c /src/mesa/state_tracker/st_cb_bitmap.c | |
parent | 60041203d5847de8ab71842a6ce5d33d96cc4930 (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_cb_bitmap.c')
-rw-r--r-- | src/mesa/state_tracker/st_cb_bitmap.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index f55a5e713ff..f77ac14762f 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -351,7 +351,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, /* Release transfer */ screen->transfer_unmap(screen, transfer); - screen->tex_transfer_release(screen, &transfer); + screen->tex_transfer_destroy(transfer); return pt; } @@ -379,7 +379,7 @@ setup_bitmap_vertex_data(struct st_context *st, GLuint i; if (st->bitmap.vbuf_slot >= max_slots) { - pipe_buffer_reference(pipe->screen, &st->bitmap.vbuf, NULL); + pipe_buffer_reference(&st->bitmap.vbuf, NULL); st->bitmap.vbuf_slot = 0; } @@ -571,7 +571,7 @@ reset_cache(struct st_context *st) cache->ymax = -1000000; if (cache->trans) - screen->tex_transfer_release(screen, &cache->trans); + screen->tex_transfer_destroy(cache->trans); assert(!cache->texture); @@ -623,7 +623,7 @@ st_flush_bitmap_cache(struct st_context *st) screen->transfer_unmap(screen, cache->trans); cache->buffer = NULL; - screen->tex_transfer_release(screen, &cache->trans); + screen->tex_transfer_destroy(cache->trans); draw_bitmap_quad(st->ctx, cache->xpos, @@ -651,7 +651,7 @@ st_flush_bitmap( struct st_context *st ) /* Release vertex buffer to avoid synchronous rendering if we were * to map it in the next frame. */ - pipe_buffer_reference(st->pipe->screen, &st->bitmap.vbuf, NULL); + pipe_buffer_reference(&st->bitmap.vbuf, NULL); st->bitmap.vbuf_slot = 0; } @@ -819,7 +819,7 @@ st_destroy_bitmap(struct st_context *st) struct bitmap_cache *cache = st->bitmap.cache; screen->transfer_unmap(screen, cache->trans); - screen->tex_transfer_release(screen, &cache->trans); + screen->tex_transfer_destroy(cache->trans); if (st->bitmap.vs) { cso_delete_vertex_shader(st->cso_context, st->bitmap.vs); @@ -828,12 +828,12 @@ st_destroy_bitmap(struct st_context *st) util_free_shader(&st->bitmap.vert_shader); if (st->bitmap.vbuf) { - pipe_buffer_reference(pipe->screen, &st->bitmap.vbuf, NULL); + pipe_buffer_reference(&st->bitmap.vbuf, NULL); st->bitmap.vbuf = NULL; } if (st->bitmap.cache) { - pipe_texture_release(&st->bitmap.cache->texture); + pipe_texture_reference(&st->bitmap.cache->texture, NULL); _mesa_free(st->bitmap.cache); st->bitmap.cache = NULL; } |