summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nvc0
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-03-13 13:06:42 +0100
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2011-03-13 13:23:55 +0100
commit26a199efac43cc0509f174ca47ad0d2b0044eee0 (patch)
treed0c4f32958fe8ac5553767c30996a0597b069287 /src/gallium/drivers/nvc0
parent259efc90e7a1a14bc1797707c8f05d5200f4d0b6 (diff)
nv50,nvc0: add some missing resource referencing
Diffstat (limited to 'src/gallium/drivers/nvc0')
-rw-r--r--src/gallium/drivers/nvc0/nvc0_context.c27
-rw-r--r--src/gallium/drivers/nvc0/nvc0_state.c11
2 files changed, 34 insertions, 4 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_context.c b/src/gallium/drivers/nvc0/nvc0_context.c
index 881d102dab..e4014b0d7c 100644
--- a/src/gallium/drivers/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nvc0/nvc0_context.c
@@ -57,10 +57,37 @@ nvc0_flush(struct pipe_context *pipe,
}
static void
+nvc0_context_unreference_resources(struct nvc0_context *nvc0)
+{
+ unsigned s, i;
+
+ for (i = 0; i < NVC0_BUFCTX_COUNT; ++i)
+ nvc0_bufctx_reset(nvc0, i);
+
+ for (i = 0; i < nvc0->num_vtxbufs; ++i)
+ pipe_resource_reference(&nvc0->vtxbuf[i].buffer, NULL);
+
+ pipe_resource_reference(&nvc0->idxbuf.buffer, NULL);
+
+ for (s = 0; s < 5; ++s) {
+ for (i = 0; i < nvc0->num_textures[s]; ++i)
+ pipe_sampler_view_reference(&nvc0->textures[s][i], NULL);
+
+ for (i = 0; i < 16; ++i)
+ pipe_resource_reference(&nvc0->constbuf[s][i], NULL);
+ }
+
+ for (i = 0; i < nvc0->num_tfbbufs; ++i)
+ pipe_resource_reference(&nvc0->tfbbuf[i], NULL);
+}
+
+static void
nvc0_destroy(struct pipe_context *pipe)
{
struct nvc0_context *nvc0 = nvc0_context(pipe);
+ nvc0_context_unreference_resources(nvc0);
+
draw_destroy(nvc0->draw);
if (nvc0->screen->cur_ctx == nvc0) {
diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c
index 1815fe88a9..ab68abcfb5 100644
--- a/src/gallium/drivers/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nvc0/nvc0_state.c
@@ -708,10 +708,13 @@ nvc0_set_index_buffer(struct pipe_context *pipe,
{
struct nvc0_context *nvc0 = nvc0_context(pipe);
- if (ib)
- memcpy(&nvc0->idxbuf, ib, sizeof(nvc0->idxbuf));
- else
- nvc0->idxbuf.buffer = NULL;
+ if (ib) {
+ pipe_resource_reference(&nvc0->idxbuf.buffer, ib->buffer);
+
+ memcpy(&nvc0->idxbuf, ib, sizeof(nvc0->idxbuf));
+ } else {
+ pipe_resource_reference(&nvc0->idxbuf.buffer, NULL);
+ }
}
static void