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 <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Ian Romanick 2014-07-08 18:55:27 -07:00
parent a99482482d
commit 04e1357d97
4 changed files with 23 additions and 0 deletions

View file

@ -210,6 +210,7 @@ initialize_context(struct gl_context *ctx, gl_api api)
break;
}
ctx->Const.GenerateTemporaryNames = true;
ctx->Driver.NewShader = _mesa_new_shader;
}

View file

@ -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;

View file

@ -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.
*

View file

@ -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);