diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/main.cpp | 1 | ||||
-rw-r--r-- | src/mesa/main/context.c | 6 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 13 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.c | 3 |
4 files changed, 23 insertions, 0 deletions
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); |