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.
This commit is contained in:
@@ -803,7 +803,7 @@ st_destroy_bitmap(struct st_context *st)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (st->bitmap.vs) {
|
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;
|
st->bitmap.vs = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -98,11 +98,11 @@ st_destroy_clear(struct st_context *st)
|
|||||||
struct pipe_context *pipe = st->pipe;
|
struct pipe_context *pipe = st->pipe;
|
||||||
|
|
||||||
if (st->clear.fs) {
|
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;
|
st->clear.fs = NULL;
|
||||||
}
|
}
|
||||||
if (st->clear.vs) {
|
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;
|
st->clear.vs = NULL;
|
||||||
}
|
}
|
||||||
if (st->clear.vbuf) {
|
if (st->clear.vbuf) {
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
#include "shader/programopt.h"
|
#include "shader/programopt.h"
|
||||||
#include "shader/shader_api.h"
|
#include "shader/shader_api.h"
|
||||||
|
|
||||||
#include "cso_cache/cso_cache.h"
|
#include "cso_cache/cso_context.h"
|
||||||
#include "draw/draw_context.h"
|
#include "draw/draw_context.h"
|
||||||
|
|
||||||
#include "st_context.h"
|
#include "st_context.h"
|
||||||
@@ -127,7 +127,6 @@ void
|
|||||||
st_delete_program(GLcontext *ctx, struct gl_program *prog)
|
st_delete_program(GLcontext *ctx, struct gl_program *prog)
|
||||||
{
|
{
|
||||||
struct st_context *st = st_context(ctx);
|
struct st_context *st = st_context(ctx);
|
||||||
struct pipe_context *pipe = st->pipe;
|
|
||||||
|
|
||||||
switch( prog->Target ) {
|
switch( prog->Target ) {
|
||||||
case GL_VERTEX_PROGRAM_ARB:
|
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;
|
struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
|
||||||
|
|
||||||
if (stvp->driver_shader) {
|
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;
|
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;
|
struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
|
||||||
|
|
||||||
if (stfp->driver_shader) {
|
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;
|
stfp->driver_shader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +186,6 @@ static void st_program_string_notify( GLcontext *ctx,
|
|||||||
struct gl_program *prog )
|
struct gl_program *prog )
|
||||||
{
|
{
|
||||||
struct st_context *st = st_context(ctx);
|
struct st_context *st = st_context(ctx);
|
||||||
struct pipe_context *pipe = st->pipe;
|
|
||||||
|
|
||||||
if (target == GL_FRAGMENT_PROGRAM_ARB) {
|
if (target == GL_FRAGMENT_PROGRAM_ARB) {
|
||||||
struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
|
struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
|
||||||
@@ -195,7 +193,7 @@ static void st_program_string_notify( GLcontext *ctx,
|
|||||||
stfp->serialNo++;
|
stfp->serialNo++;
|
||||||
|
|
||||||
if (stfp->driver_shader) {
|
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;
|
stfp->driver_shader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +213,7 @@ static void st_program_string_notify( GLcontext *ctx,
|
|||||||
stvp->serialNo++;
|
stvp->serialNo++;
|
||||||
|
|
||||||
if (stvp->driver_shader) {
|
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;
|
stvp->driver_shader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -176,22 +176,29 @@ static void st_destroy_context_priv( struct st_context *st )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
st->pipe->destroy( st->pipe );
|
|
||||||
free( st );
|
free( st );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void st_destroy_context( struct st_context *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;
|
GLcontext *ctx = st->ctx;
|
||||||
|
|
||||||
/* need to unbind and destroy CSO objects before anything else */
|
/* 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_delete_program_cache(st->ctx, st->pixel_xfer.cache);
|
||||||
|
|
||||||
_mesa_free_context_data(ctx);
|
_mesa_free_context_data(ctx);
|
||||||
|
|
||||||
st_destroy_context_priv(st);
|
st_destroy_context_priv(st);
|
||||||
|
|
||||||
|
cso_destroy_context(cso);
|
||||||
|
|
||||||
|
pipe->destroy( pipe );
|
||||||
|
|
||||||
free(ctx);
|
free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -270,7 +270,7 @@ st_translate_vertex_program(struct st_context *st,
|
|||||||
stvp->state.tokens = NULL;
|
stvp->state.tokens = NULL;
|
||||||
}
|
}
|
||||||
if (stvp->driver_shader) {
|
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;
|
stvp->driver_shader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user