summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-04-24 12:11:24 -0600
committerBrian Paul <[email protected]>2008-04-24 12:15:05 -0600
commita770d40c3d4977e2c134661b5d8facaea446b6ea (patch)
treead72c97ae622bf0c0d952affad0b41de6961a99b /src/mesa
parent386102c62a3315182ffbc6319351cb883234511a (diff)
gallium: use cso_destroy_vertex/fragment_shader() functions
Also, rearrange the st_destroy_context() code a bit to prevent some invalid/NULL ptr derefs during tear-down.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c2
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c4
-rw-r--r--src/mesa/state_tracker/st_cb_program.c12
-rw-r--r--src/mesa/state_tracker/st_context.c11
-rw-r--r--src/mesa/state_tracker/st_program.c2
5 files changed, 18 insertions, 13 deletions
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 7752b40e8ba..e7f6ff66b57 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -803,7 +803,7 @@ st_destroy_bitmap(struct st_context *st)
}
#endif
if (st->bitmap.vs) {
- pipe->delete_vs_state(pipe, st->bitmap.vs);
+ cso_delete_vertex_shader(st->cso_context, st->bitmap.vs);
st->bitmap.vs = NULL;
}
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index dac346a06c1..95a5fb8db47 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -98,11 +98,11 @@ st_destroy_clear(struct st_context *st)
struct pipe_context *pipe = st->pipe;
if (st->clear.fs) {
- pipe->delete_fs_state(pipe, st->clear.fs);
+ cso_delete_fragment_shader(st->cso_context, st->clear.fs);
st->clear.fs = NULL;
}
if (st->clear.vs) {
- pipe->delete_vs_state(pipe, st->clear.vs);
+ cso_delete_vertex_shader(st->cso_context, st->clear.vs);
st->clear.vs = NULL;
}
if (st->clear.vbuf) {
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 67f8b1f8ebb..a293ec3f0b9 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -39,7 +39,7 @@
#include "shader/programopt.h"
#include "shader/shader_api.h"
-#include "cso_cache/cso_cache.h"
+#include "cso_cache/cso_context.h"
#include "draw/draw_context.h"
#include "st_context.h"
@@ -127,7 +127,6 @@ void
st_delete_program(GLcontext *ctx, struct gl_program *prog)
{
struct st_context *st = st_context(ctx);
- struct pipe_context *pipe = st->pipe;
switch( prog->Target ) {
case GL_VERTEX_PROGRAM_ARB:
@@ -135,7 +134,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog)
struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
if (stvp->driver_shader) {
- pipe->delete_vs_state(pipe, stvp->driver_shader);
+ cso_delete_vertex_shader(st->cso_context, stvp->driver_shader);
stvp->driver_shader = NULL;
}
@@ -150,7 +149,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog)
struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
if (stfp->driver_shader) {
- pipe->delete_fs_state(pipe, stfp->driver_shader);
+ cso_delete_fragment_shader(st->cso_context, stfp->driver_shader);
stfp->driver_shader = NULL;
}
@@ -187,7 +186,6 @@ static void st_program_string_notify( GLcontext *ctx,
struct gl_program *prog )
{
struct st_context *st = st_context(ctx);
- struct pipe_context *pipe = st->pipe;
if (target == GL_FRAGMENT_PROGRAM_ARB) {
struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
@@ -195,7 +193,7 @@ static void st_program_string_notify( GLcontext *ctx,
stfp->serialNo++;
if (stfp->driver_shader) {
- pipe->delete_fs_state(pipe, stfp->driver_shader);
+ cso_delete_fragment_shader(st->cso_context, stfp->driver_shader);
stfp->driver_shader = NULL;
}
@@ -215,7 +213,7 @@ static void st_program_string_notify( GLcontext *ctx,
stvp->serialNo++;
if (stvp->driver_shader) {
- pipe->delete_vs_state(pipe, stvp->driver_shader);
+ cso_delete_vertex_shader(st->cso_context, stvp->driver_shader);
stvp->driver_shader = NULL;
}
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index dadc524b51a..8a30871fa07 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -176,22 +176,29 @@ static void st_destroy_context_priv( struct st_context *st )
}
}
- st->pipe->destroy( st->pipe );
free( st );
}
void st_destroy_context( struct st_context *st )
{
+ struct pipe_context *pipe = st->pipe;
+ struct cso_context *cso = st->cso_context;
GLcontext *ctx = st->ctx;
/* need to unbind and destroy CSO objects before anything else */
- cso_destroy_context(st->cso_context);
+ cso_release_all(st->cso_context);
_mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache);
_mesa_free_context_data(ctx);
+
st_destroy_context_priv(st);
+
+ cso_destroy_context(cso);
+
+ pipe->destroy( pipe );
+
free(ctx);
}
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 3648ded8a1d..d450c306947 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -270,7 +270,7 @@ st_translate_vertex_program(struct st_context *st,
stvp->state.tokens = NULL;
}
if (stvp->driver_shader) {
- pipe->delete_vs_state(pipe, stvp->driver_shader);
+ cso_delete_vertex_shader(st->cso_context, stvp->driver_shader);
stvp->driver_shader = NULL;
}