From 90e29afcb62411b69d57dac76fe89c69c9936ed6 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 8 Jan 2011 15:40:14 +0100 Subject: nvfx,nv50: pipe_reference the constant buffers --- src/gallium/drivers/nv50/nv50_state.c | 9 ++++----- src/gallium/drivers/nvfx/nvfx_state.c | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index d97566ed7c..b4eda0f617 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -721,17 +721,16 @@ nv50_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, struct nv50_context *nv50 = nv50_context(pipe); if (shader == PIPE_SHADER_VERTEX) { - nv50->constbuf[PIPE_SHADER_VERTEX] = buf; nv50->dirty |= NV50_NEW_VERTPROG_CB; } else if (shader == PIPE_SHADER_FRAGMENT) { - nv50->constbuf[PIPE_SHADER_FRAGMENT] = buf; nv50->dirty |= NV50_NEW_FRAGPROG_CB; - } else - if (shader == PIPE_SHADER_GEOMETRY) { - nv50->constbuf[PIPE_SHADER_GEOMETRY] = buf; + } else { + assert(shader == PIPE_SHADER_GEOMETRY); nv50->dirty |= NV50_NEW_GEOMPROG_CB; } + + pipe_resource_reference(&nv50->constbuf[shader], buf); } static void diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c index 54619037d8..f3dcb205c6 100644 --- a/src/gallium/drivers/nvfx/nvfx_state.c +++ b/src/gallium/drivers/nvfx/nvfx_state.c @@ -304,7 +304,7 @@ nvfx_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, { struct nvfx_context *nvfx = nvfx_context(pipe); - nvfx->constbuf[shader] = buf; + pipe_resource_reference(&nvfx->constbuf[shader], buf); nvfx->constbuf_nr[shader] = buf ? (buf->width0 / (4 * sizeof(float))) : 0; if (shader == PIPE_SHADER_VERTEX) { -- cgit v1.2.3