Commit a73cb106 authored by Mike Blumenkrantz's avatar Mike Blumenkrantz 🏋 Committed by Marge Bot
Browse files

aux/cso: split cso_destroy_context into unbind and a destroy functions



this makes the unbind function reusable
Reviewed-by: default avatarMarek Olšák <marek.olsak@amd.com>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
Part-of: <mesa/mesa!11071>
parent 3b66d70f
......@@ -285,10 +285,7 @@ cso_create_context(struct pipe_context *pipe, unsigned flags)
return ctx;
}
/**
* Free the CSO context.
*/
void cso_destroy_context( struct cso_context *ctx )
void cso_unbind_context(struct cso_context *ctx)
{
unsigned i;
......@@ -355,6 +352,8 @@ void cso_destroy_context( struct cso_context *ctx )
}
ctx->pipe->bind_depth_stencil_alpha_state( ctx->pipe, NULL );
struct pipe_stencil_ref sr = {0};
ctx->pipe->set_stencil_ref(ctx->pipe, sr);
ctx->pipe->bind_fs_state( ctx->pipe, NULL );
ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, false, NULL);
ctx->pipe->bind_vs_state( ctx->pipe, NULL );
......@@ -383,6 +382,16 @@ void cso_destroy_context( struct cso_context *ctx )
pipe_so_target_reference(&ctx->so_targets_saved[i], NULL);
}
memset(&ctx->samplers, 0, sizeof(ctx->samplers));
memset(&ctx->nr_so_targets, 0, offsetof(struct cso_context, cache) - offsetof(struct cso_context, nr_so_targets));
}
/**
* Free the CSO context.
*/
void cso_destroy_context( struct cso_context *ctx )
{
cso_unbind_context(ctx);
cso_cache_delete(&ctx->cache);
if (ctx->vbuf)
......
......@@ -48,6 +48,7 @@ struct u_vbuf;
struct cso_context *cso_create_context(struct pipe_context *pipe,
unsigned flags);
void cso_unbind_context(struct cso_context *ctx);
void cso_destroy_context( struct cso_context *cso );
struct pipe_context *cso_get_pipe_context(struct cso_context *cso);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment