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().
This commit is contained in:
@@ -73,7 +73,7 @@ void st_upload_constants( struct st_context *st,
|
||||
/* We always need to get a new buffer, to keep the drivers simple and
|
||||
* avoid gratuitous rendering synchronization.
|
||||
*/
|
||||
pipe_buffer_reference(pipe->screen, &cbuf->buffer, NULL );
|
||||
pipe_buffer_reference(&cbuf->buffer, NULL );
|
||||
cbuf->buffer = pipe_buffer_create(pipe->screen, 16, PIPE_BUFFER_USAGE_CONSTANT,
|
||||
paramBytes );
|
||||
|
||||
|
Reference in New Issue
Block a user