Skip to content
Browse files

cso: unreference saved vertex buffers when restoring

Reviewed-by: Brian Paul <brianp@vmware.com>
  • Loading branch information...
1 parent 249fc70 commit 6f03692775ed49035802d660516b7d7464c7a1ad @marekolsak marekolsak committed Apr 10, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/gallium/auxiliary/cso_cache/cso_context.c
View
8 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);
}

0 comments on commit 6f03692

Please sign in to comment.
Something went wrong with that request. Please try again.