aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-11-18 19:49:55 +0100
committerMarek Olšák <[email protected]>2016-11-22 18:05:51 +0100
commitb818df1e714ed8bd2f1c3a68ee842cd81a0d7cf4 (patch)
treeec681ad62ab1b0322c8dab0244b2032fa226d5bf /src/mesa
parent6dfdf52b6af416fccf28420d64585d809d745b0a (diff)
glsl: add gl_linked_shader::SourceChecksum
for debugging v2: wrap all checksums in #ifdef DEBUG Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/mtypes.h8
-rw-r--r--src/mesa/main/shaderapi.c6
-rw-r--r--src/mesa/program/prog_print.c4
3 files changed, 17 insertions, 1 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 485f5f18f48..26b19653cb8 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2282,6 +2282,10 @@ struct gl_linked_shader
{
gl_shader_stage Stage;
+#ifdef DEBUG
+ unsigned SourceChecksum;
+#endif
+
struct gl_program *Program; /**< Post-compile assembly code */
/**
@@ -2414,7 +2418,9 @@ struct gl_shader
GLboolean CompileStatus;
bool IsES; /**< True if this shader uses GLSL ES */
- GLuint SourceChecksum; /**< for debug/logging purposes */
+#ifdef DEBUG
+ unsigned SourceChecksum; /**< for debug/logging purposes */
+#endif
const GLchar *Source; /**< Source code string */
GLchar *InfoLog;
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 9592857f0f2..83ee0d4ca7d 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1149,10 +1149,16 @@ print_shader_info(const struct gl_shader_program *shProg)
printf("Mesa: glUseProgram(%u)\n", shProg->Name);
for (i = 0; i < shProg->NumShaders; i++) {
+#ifdef DEBUG
printf(" %s shader %u, checksum %u\n",
_mesa_shader_stage_to_string(shProg->Shaders[i]->Stage),
shProg->Shaders[i]->Name,
shProg->Shaders[i]->SourceChecksum);
+#else
+ printf(" %s shader %u\n",
+ _mesa_shader_stage_to_string(shProg->Shaders[i]->Stage),
+ shProg->Shaders[i]->Name);
+#endif
}
if (shProg->_LinkedShaders[MESA_SHADER_VERTEX])
printf(" vert prog %u\n",
diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c
index bdeb8fd6752..0a4bc51e954 100644
--- a/src/mesa/program/prog_print.c
+++ b/src/mesa/program/prog_print.c
@@ -976,7 +976,11 @@ _mesa_write_shader_to_file(const struct gl_shader *shader)
return;
}
+#ifdef DEBUG
fprintf(f, "/* Shader %u source, checksum %u */\n", shader->Name, shader->SourceChecksum);
+#else
+ fprintf(f, "/* Shader %u source */\n", shader->Name);
+#endif
fputs(shader->Source, f);
fprintf(f, "\n");