summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shaderapi.c
diff options
context:
space:
mode:
authorGregory Hainaut <[email protected]>2013-06-28 13:43:43 -0700
committerIan Romanick <[email protected]>2014-02-21 15:41:02 -0800
commit0f137a1d73c415dc8744d4b9e6c194232715f023 (patch)
treeaffe87d5f8ad08c2225cfdbb01635618210bbc71 /src/mesa/main/shaderapi.c
parent47476fa673eb2eaf3046674c35bce533b38ad800 (diff)
mesa: Add a mutex and refcounting to gl_shader_state
Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/mesa/main/shaderapi.c')
-rw-r--r--src/mesa/main/shaderapi.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 939e980174e..ac95dc735cf 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -121,6 +121,10 @@ _mesa_init_shader_state(struct gl_context *ctx)
memcpy(&ctx->ShaderCompilerOptions[sh], &options, sizeof(options));
ctx->Shader.Flags = _mesa_get_shader_flags();
+
+ /* Extended for ARB_separate_shader_objects */
+ ctx->Shader.RefCount = 1;
+ _glthread_INIT_MUTEX(ctx->Shader.Mutex);
}
@@ -138,6 +142,10 @@ _mesa_free_shader_state(struct gl_context *ctx)
_mesa_reference_shader_program(ctx, &ctx->Shader._CurrentFragmentProgram,
NULL);
_mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, NULL);
+
+ /* Extended for ARB_separate_shader_objects */
+ assert(ctx->Shader.RefCount == 1);
+ _glthread_DESTROY_MUTEX(ctx->Shader.Mutex);
}