cso: put cso_release_all into cso_destroy_context

Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Marek Olšák 2014-12-07 14:21:41 +01:00
parent ee5fb8d1ba
commit 0a60ebe30c
9 changed files with 9 additions and 38 deletions

View File

@ -286,9 +286,9 @@ out:
}
/**
* Prior to context destruction, this function unbinds all state objects.
* Free the CSO context.
*/
void cso_release_all( struct cso_context *ctx )
void cso_destroy_context( struct cso_context *ctx )
{
unsigned i, shader;
@ -355,20 +355,10 @@ void cso_release_all( struct cso_context *ctx )
cso_cache_delete( ctx->cache );
ctx->cache = NULL;
}
}
/**
* Free the CSO context. NOTE: the state tracker should have previously called
* cso_release_all().
*/
void cso_destroy_context( struct cso_context *ctx )
{
if (ctx) {
if (ctx->vbuf)
u_vbuf_destroy(ctx->vbuf);
FREE( ctx );
}
if (ctx->vbuf)
u_vbuf_destroy(ctx->vbuf);
FREE( ctx );
}

View File

@ -42,13 +42,9 @@ struct cso_context;
struct u_vbuf;
struct cso_context *cso_create_context( struct pipe_context *pipe );
void cso_release_all( struct cso_context *ctx );
void cso_destroy_context( struct cso_context *cso );
enum pipe_error cso_set_blend( struct cso_context *cso,
const struct pipe_blend_state *blend );
void cso_save_blend(struct cso_context *cso);

View File

@ -248,7 +248,6 @@ tgsi_vs_window_space_position(struct pipe_context *ctx)
cb->width0, cb->height0, red);
/* Cleanup. */
cso_release_all(cso);
cso_destroy_context(cso);
ctx->delete_vs_state(ctx, vs);
ctx->delete_fs_state(ctx, fs);

View File

@ -360,7 +360,6 @@ NineDevice9_dtor( struct NineDevice9 *This )
/* state stuff */
if (This->pipe) {
if (This->cso) {
cso_release_all(This->cso);
cso_destroy_context(This->cso);
}
if (This->pipe->destroy) { This->pipe->destroy(This->pipe); }

View File

@ -161,7 +161,6 @@ void vg_destroy_context(struct vg_context *ctx)
if (ctx->mask.set_fs)
vg_shader_destroy(ctx, ctx->mask.set_fs);
cso_release_all(ctx->cso_context);
cso_destroy_context(ctx->cso_context);
cso_hash_delete(ctx->owned_objects[VG_OBJECT_PAINT]);

View File

@ -82,7 +82,6 @@ xa_context_destroy(struct xa_context *r)
pipe_surface_reference(&r->srf, NULL);
if (r->cso) {
cso_release_all(r->cso);
cso_destroy_context(r->cso);
r->cso = NULL;
}

View File

@ -275,11 +275,7 @@ static void init_prog(struct program *p)
static void close_prog(struct program *p)
{
/* unset bound textures as well */
cso_set_sampler_views(p->cso, PIPE_SHADER_FRAGMENT, 0, NULL);
/* unset all state */
cso_release_all(p->cso);
cso_destroy_context(p->cso);
p->pipe->delete_vs_state(p->pipe, p->vs);
p->pipe->delete_fs_state(p->pipe, p->fs);
@ -290,7 +286,6 @@ static void close_prog(struct program *p)
pipe_resource_reference(&p->tex, NULL);
pipe_resource_reference(&p->vbuf, NULL);
cso_destroy_context(p->cso);
p->pipe->destroy(p->pipe);
p->screen->destroy(p->screen);
pipe_loader_release(&p->dev, 1);

View File

@ -221,8 +221,7 @@ static void init_prog(struct program *p)
static void close_prog(struct program *p)
{
/* unset all state */
cso_release_all(p->cso);
cso_destroy_context(p->cso);
p->pipe->delete_vs_state(p->pipe, p->vs);
p->pipe->delete_fs_state(p->pipe, p->fs);
@ -231,7 +230,6 @@ static void close_prog(struct program *p)
pipe_resource_reference(&p->target, NULL);
pipe_resource_reference(&p->vbuf, NULL);
cso_destroy_context(p->cso);
p->pipe->destroy(p->pipe);
p->screen->destroy(p->screen);
pipe_loader_release(&p->dev, 1);

View File

@ -136,6 +136,8 @@ st_destroy_context_priv(struct st_context *st)
if (st->constbuf_uploader) {
u_upload_destroy(st->constbuf_uploader);
}
cso_destroy_context(st->cso_context);
free( st );
}
@ -348,15 +350,11 @@ destroy_tex_sampler_cb(GLuint id, void *data, void *userData)
void st_destroy_context( struct st_context *st )
{
struct pipe_context *pipe = st->pipe;
struct cso_context *cso = st->cso_context;
struct gl_context *ctx = st->ctx;
GLuint i;
_mesa_HashWalk(ctx->Shared->TexObjects, destroy_tex_sampler_cb, st);
/* need to unbind and destroy CSO objects before anything else */
cso_release_all(st->cso_context);
st_reference_fragprog(st, &st->fp, NULL);
st_reference_geomprog(st, &st->gp, NULL);
st_reference_vertprog(st, &st->vp, NULL);
@ -386,8 +384,6 @@ void st_destroy_context( struct st_context *st )
st_destroy_context_priv(st);
st = NULL;
cso_destroy_context(cso);
pipe->destroy( pipe );
free(ctx);