summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shaderapi.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-05-17 07:44:32 -0600
committerBrian Paul <brianp@vmware.com>2012-05-19 08:28:56 -0600
commit0161691f3518db310411c5f02c05aa639050f129 (patch)
tree8d0081ee635b6bbe5604353aeb0d6d96e6f7baf0 /src/mesa/main/shaderapi.c
parent1c333745f3dc1e0304295684a8e77af45fe2b40e (diff)
downloadexternal_mesa3d-0161691f3518db310411c5f02c05aa639050f129.zip
external_mesa3d-0161691f3518db310411c5f02c05aa639050f129.tar.gz
external_mesa3d-0161691f3518db310411c5f02c05aa639050f129.tar.bz2
mesa: add GLSL_REPORT_ERRORS debug flag
If the MESA_GLSL env var contains "errors", GLSL compilation and link errors will be reported to stderr. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/mesa/main/shaderapi.c')
-rw-r--r--src/mesa/main/shaderapi.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 3e03239..6927368 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -83,6 +83,8 @@ get_shader_flags(void)
flags |= GLSL_UNIFORMS;
if (strstr(env, "useprog"))
flags |= GLSL_USE_PROG;
+ if (strstr(env, "errors"))
+ flags |= GLSL_REPORT_ERRORS;
}
return flags;
@@ -673,6 +675,12 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj)
* compilation was successful.
*/
_mesa_glsl_compile_shader(ctx, sh);
+
+ if (sh->CompileStatus == GL_FALSE &&
+ (ctx->Shader.Flags & GLSL_REPORT_ERRORS)) {
+ _mesa_debug(ctx, "Error compiling shader %u:\n%s\n",
+ sh->Name, sh->InfoLog);
+ }
}
@@ -703,6 +711,12 @@ link_program(struct gl_context *ctx, GLuint program)
_mesa_glsl_link_shader(ctx, shProg);
+ if (shProg->LinkStatus == GL_FALSE &&
+ (ctx->Shader.Flags & GLSL_REPORT_ERRORS)) {
+ _mesa_debug(ctx, "Error linking program %u:\n%s\n",
+ shProg->Name, shProg->InfoLog);
+ }
+
/* debug code */
if (0) {
GLuint i;