summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorBrian <brian@nostromo.localnet.net>2007-03-24 16:20:02 -0600
committerBrian <brian@nostromo.localnet.net>2007-03-24 16:20:02 -0600
commit935f93f966aa298c4d4115ac766cb2ff46ad6514 (patch)
tree49ae8900b2b900a7d89108ce28aef3e025dc7c6e /src/mesa/shader
parent3493e867e9f2421425627a15eb5d2a2c554fbe8a (diff)
Free shader-related context state: _mesa_free_shader_state()
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/shader_api.c16
-rw-r--r--src/mesa/shader/shader_api.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 88aa8c50f5b..002b42721df 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -212,6 +212,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>.
* \param src the strings source
diff --git a/src/mesa/shader/shader_api.h b/src/mesa/shader/shader_api.h
index 315f60a35f7..16ed1a0c108 100644
--- a/src/mesa/shader/shader_api.h
+++ b/src/mesa/shader/shader_api.h
@@ -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);