mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-07 07:40:30 +01:00
aux/cso: split cso_destroy_context into unbind and a destroy functions
this makes the unbind function reusable Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11071>
This commit is contained in:
parent
3b66d70fba
commit
a73cb106a6
2 changed files with 14 additions and 4 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue