}
/**
- * 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;
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 );
}
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);
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);
/* 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); }
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]);
pipe_surface_reference(&r->srf, NULL);
if (r->cso) {
- cso_release_all(r->cso);
cso_destroy_context(r->cso);
r->cso = NULL;
}
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);
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);
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);
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);
if (st->constbuf_uploader) {
u_upload_destroy(st->constbuf_uploader);
}
+
+ cso_destroy_context(st->cso_context);
free( st );
}
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);
st_destroy_context_priv(st);
st = NULL;
- cso_destroy_context(cso);
-
pipe->destroy( pipe );
free(ctx);