_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
}
+/**
+ * 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>.
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);