summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-12-07 14:21:41 +0100
committerMarek Olšák <[email protected]>2014-12-10 21:59:36 +0100
commit0a60ebe30c186daf1fbe569e07bfe2e75f765824 (patch)
tree280a661cbf9b49842ffb8009867055e30a6c9df4 /src
parentee5fb8d1ba7f50ed94e1a34fa0f6e15a0588145e (diff)
cso: put cso_release_all into cso_destroy_context
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c20
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.h4
-rw-r--r--src/gallium/auxiliary/util/u_tests.c1
-rw-r--r--src/gallium/state_trackers/nine/device9.c1
-rw-r--r--src/gallium/state_trackers/vega/vg_context.c1
-rw-r--r--src/gallium/state_trackers/xa/xa_context.c1
-rw-r--r--src/gallium/tests/trivial/quad-tex.c7
-rw-r--r--src/gallium/tests/trivial/tri.c4
-rw-r--r--src/mesa/state_tracker/st_context.c8
9 files changed, 9 insertions, 38 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 3d8860f7b88..5d597ba5c29 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -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 );
}
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
index f0a08bb0d2c..aa56c589dad 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -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);
diff --git a/src/gallium/auxiliary/util/u_tests.c b/src/gallium/auxiliary/util/u_tests.c
index c0f6327b6e9..b42f5e137ba 100644
--- a/src/gallium/auxiliary/util/u_tests.c
+++ b/src/gallium/auxiliary/util/u_tests.c
@@ -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);
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index e9599b853c0..b0e42ebc8ab 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -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); }
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index 46c7d9649fd..48a03c5a64a 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -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]);
diff --git a/src/gallium/state_trackers/xa/xa_context.c b/src/gallium/state_trackers/xa/xa_context.c
index df3043c8929..fd49c82a559 100644
--- a/src/gallium/state_trackers/xa/xa_context.c
+++ b/src/gallium/state_trackers/xa/xa_context.c
@@ -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;
}
diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c
index 0d380125a57..abecedbd594 100644
--- a/src/gallium/tests/trivial/quad-tex.c
+++ b/src/gallium/tests/trivial/quad-tex.c
@@ -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);
diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c
index 13cc801ec63..078beb8f43f 100644
--- a/src/gallium/tests/trivial/tri.c
+++ b/src/gallium/tests/trivial/tri.c
@@ -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);
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 9da0c776d96..9fd6caece73 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -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);