Mesa (master): mesa: Make MESA_GLSL=dump include when compile/link fails, and the info log.

Eric Anholt anholt at kemper.freedesktop.org
Wed Aug 18 14:20:37 PDT 2010


Module: Mesa
Branch: master
Commit: 0df61bdb669d03d9c25e49d5698f193deca3cf6d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0df61bdb669d03d9c25e49d5698f193deca3cf6d

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Aug 18 11:35:15 2010 -0700

mesa: Make MESA_GLSL=dump include when compile/link fails, and the info log.

---

 src/mesa/program/ir_to_mesa.cpp |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 7de1939..58d3b41 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2691,10 +2691,18 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader)
       _mesa_write_shader_to_file(shader);
    }
 
-   if ((ctx->Shader.Flags & GLSL_DUMP) && shader->CompileStatus) {
-      printf("GLSL IR for shader %d:\n", shader->Name);
-      _mesa_print_ir(shader->ir, NULL);
-      printf("\n\n");
+   if (ctx->Shader.Flags & GLSL_DUMP) {
+      if (shader->CompileStatus) {
+	 printf("GLSL IR for shader %d:\n", shader->Name);
+	 _mesa_print_ir(shader->ir, NULL);
+	 printf("\n\n");
+      } else {
+	 printf("GLSL shader %d failed to compile.\n", shader->Name);
+      }
+      if (shader->InfoLog && shader->InfoLog[0] != 0) {
+	 printf("GLSL shader %d info log:\n", shader->Name);
+	 printf("%s\n", shader->InfoLog);
+      }
    }
 
    /* Retain any live IR, but trash the rest. */
@@ -2741,8 +2749,15 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog)
    }
 
    if (prog->LinkStatus) {
-      if (!ctx->Driver.LinkShader(ctx, prog))
+      if (!ctx->Driver.LinkShader(ctx, prog)) {
 	 prog->LinkStatus = GL_FALSE;
+	 printf("GLSL shader program %d failed to link\n", prog->Name);
+      }
+
+      if (prog->InfoLog && prog->InfoLog[0] != 0) {
+	 printf("GLSL shader program %d info log:\n", prog->Name);
+	 printf("%s\n", prog->InfoLog);
+      }
    }
 }
 



More information about the mesa-commit mailing list