From: Ian Romanick Date: Wed, 9 Jul 2014 01:55:27 +0000 (-0700) Subject: glsl: Add context-level controls for whether temporaries have real names X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=04e1357d97ae2d99dfbf0b6e91feee54eecd6eb5;p=mesa.git glsl: Add context-level controls for whether temporaries have real names No change Valgrind massif results for a trimmed apitrace of dota2. v2: Minor rebase on _mesa_init_constants changes. Signed-off-by: Ian Romanick Reviewed-by: Matt Turner --- diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index a4452e023f2..feed100822c 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -210,6 +210,7 @@ initialize_context(struct gl_context *ctx, gl_api api) break; } + ctx->Const.GenerateTemporaryNames = true; ctx->Driver.NewShader = _mesa_new_shader; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b7e87284e30..0edd66d6f9e 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -645,6 +645,12 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api) consts->GLSLVersion = 120; _mesa_override_glsl_version(consts); +#ifdef DEBUG + consts->GenerateTemporaryNames = true; +#else + consts->GenerateTemporaryNames = false; +#endif + /* GL_ARB_framebuffer_object */ consts->MaxSamples = 0; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b66b1a85def..dd330eab729 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3571,6 +3571,19 @@ struct gl_constants */ GLboolean DisableVaryingPacking; + /** + * Should meaningful names be generated for compiler temporary variables? + * + * Generally, it is not useful to have the compiler generate "meaningful" + * names for temporary variables that it creates. This can, however, be a + * useful debugging aid. In Mesa debug builds or release builds when + * MESA_GLSL is set at run-time, meaningful names will be generated. + * Drivers can also force names to be generated by setting this field. + * For example, the i965 driver may set it when INTEL_DEBUG=vs (to dump + * vertex shader assembly) is set at run-time. + */ + bool GenerateTemporaryNames; + /* * Maximum value supported for an index in DrawElements and friends. * diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 30a75191897..3e6f61067c2 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -123,6 +123,9 @@ _mesa_init_shader_state(struct gl_context *ctx) ctx->Shader.Flags = _mesa_get_shader_flags(); + if (ctx->Shader.Flags != 0) + ctx->Const.GenerateTemporaryNames = true; + /* Extended for ARB_separate_shader_objects */ ctx->Shader.RefCount = 1; mtx_init(&ctx->Shader.Mutex, mtx_plain);