Free shader-related context state: _mesa_free_shader_state()
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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>.
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user