[Mesa-dev] [PATCH 1/5] glsl: Initialize static temporaries_allocate_names once per process.

Matt Turner mattst88 at gmail.com
Wed Nov 26 10:39:48 PST 2014


---
 src/glsl/glsl_parser_extras.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 27e3301..5772d13 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -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);
-- 
2.0.4



More information about the mesa-dev mailing list