glsl: Initialize static temporaries_allocate_names once per process.
authorMatt Turner <mattst88@gmail.com>
Sat, 22 Nov 2014 02:04:21 +0000 (18:04 -0800)
committerMatt Turner <mattst88@gmail.com>
Mon, 1 Dec 2014 19:32:48 +0000 (11:32 -0800)
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/glsl/glsl_parser_extras.cpp

index 27e3301e2093636d6c5818770d3fc2aef8c8ff65..5772d1389e15f3c1222f3b8ea0826c768530cbad 100644 (file)
@@ -29,6 +29,7 @@ extern "C" {
 #include "main/core.h" /* for struct gl_context */
 #include "main/context.h"
 #include "main/shaderobj.h"
+#include "util/u_atomic.h" /* for p_atomic_cmpxchg */
 }
 
 #include "util/ralloc.h"
@@ -1447,7 +1448,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
    const char *source = shader->Source;
 
    if (ctx->Const.GenerateTemporaryNames)
-      ir_variable::temporaries_allocate_names = true;
+      (void) p_atomic_cmpxchg(&ir_variable::temporaries_allocate_names,
+                              false, true);
 
    state->error = glcpp_preprocess(state, &source, &state->info_log,
                              &ctx->Extensions, ctx);