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/gallium/drivers/nv40/nv40_fragprog.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/gallium/drivers/nv40/nv40_fragprog.c')
-rw-r--r-- | src/gallium/drivers/nv40/nv40_fragprog.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c index 91dcbebda0d..1031e87e970 100644 --- a/src/gallium/drivers/nv40/nv40_fragprog.c +++ b/src/gallium/drivers/nv40/nv40_fragprog.c @@ -917,6 +917,7 @@ nv40_fragprog_validate(struct nv40_context *nv40) struct nv40_fragment_program *fp = nv40->fragprog; struct pipe_buffer *constbuf = nv40->constbuf[PIPE_SHADER_FRAGMENT]; + struct pipe_screen *screen = nv40->pipe.screen; struct pipe_winsys *ws = nv40->pipe.winsys; struct nouveau_stateobj *so; boolean new_consts = FALSE; @@ -932,7 +933,7 @@ nv40_fragprog_validate(struct nv40_context *nv40) return FALSE; } - fp->buffer = ws->buffer_create(ws, 0x100, 0, fp->insn_len * 4); + fp->buffer = screen->buffer_create(screen, 0x100, 0, fp->insn_len * 4); nv40_fragprog_upload(nv40, fp); so = so_new(4, 1); |