summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-04-10 08:28:23 +0200
committerMarek Olšák <[email protected]>2012-04-12 19:17:47 +0200
commit6f03692775ed49035802d660516b7d7464c7a1ad (patch)
treea1d36044cceb61d88e8313e1d19665153cb4d5a0 /src/gallium
parent249fc7056104113633215106ac085b505d8dc161 (diff)
cso: unreference saved vertex buffers when restoring
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 60a6e0262e0..43b834314dc 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -863,10 +863,18 @@ void cso_save_vertex_buffers(struct cso_context *ctx)
void cso_restore_vertex_buffers(struct cso_context *ctx)
{
+ unsigned i;
+
util_copy_vertex_buffers(ctx->vertex_buffers,
&ctx->nr_vertex_buffers,
ctx->vertex_buffers_saved,
ctx->nr_vertex_buffers_saved);
+
+ for (i = 0; i < ctx->nr_vertex_buffers_saved; i++) {
+ pipe_resource_reference(&ctx->vertex_buffers_saved[i].buffer, NULL);
+ }
+ ctx->nr_vertex_buffers_saved = 0;
+
ctx->pipe->set_vertex_buffers(ctx->pipe, ctx->nr_vertex_buffers,
ctx->vertex_buffers);
}