Mesa (master): nvfx,nv50: pipe_reference the constant buffers
Christoph Bumiller
chrisbmr at kemper.freedesktop.org
Sat Jan 8 14:41:52 UTC 2011
Module: Mesa
Branch: master
Commit: 90e29afcb62411b69d57dac76fe89c69c9936ed6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=90e29afcb62411b69d57dac76fe89c69c9936ed6
Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date: Sat Jan 8 15:40:14 2011 +0100
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(-)
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index d97566e..b4eda0f 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 5461903..f3dcb20 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) {
More information about the mesa-commit
mailing list