Free shader-related context state: _mesa_free_shader_state()

This commit is contained in:
Brian
2007-03-24 16:20:02 -06:00
parent 3493e867e9
commit 935f93f966
3 changed files with 20 additions and 0 deletions
+1
View File
@@ -1439,6 +1439,7 @@ _mesa_free_context_data( GLcontext *ctx )
_mesa_free_viewport_data( ctx );
_mesa_free_colortables_data( ctx );
_mesa_free_program_data(ctx);
_mesa_free_shader_state(ctx);
_mesa_free_query_data(ctx);
#if FEATURE_ARB_vertex_buffer_object
+16
View File
@@ -211,6 +211,22 @@ _mesa_init_shader_state(GLcontext * ctx)
}
/**
* Free the per-context shader-related state.
*/
void
_mesa_free_shader_state(GLcontext *ctx)
{
if (ctx->Shader.CurrentProgram) {
ctx->Shader.CurrentProgram->RefCount--;
if (ctx->Shader.CurrentProgram->RefCount <= 0) {
_mesa_free_shader_program(ctx, ctx->Shader.CurrentProgram);
ctx->Shader.CurrentProgram = NULL;
}
}
}
/**
* Copy string from <src> to <dst>, up to maxLength characters, returning
* length of <dst> in <length>.
+3
View File
@@ -38,6 +38,9 @@
extern void
_mesa_init_shader_state(GLcontext * ctx);
extern void
_mesa_free_shader_state(GLcontext *ctx);
extern struct gl_shader_program *
_mesa_new_shader_program(GLcontext *ctx, GLuint name);