cso: put cso_release_all into cso_destroy_context
[mesa.git] / src / mesa / state_tracker / st_context.c
index 9da0c776d9613bd0651c222873217c9efc6848ff..9fd6caece735821e4f708767809567192fab9632 100644 (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);