aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-10-15 15:25:52 -0600
committerBrian Paul <[email protected]>2009-10-16 13:07:43 -0600
commit2ee7fd8d584abf051c552f455aeb588e2936b0ea (patch)
treeddd143b06e4d927e2ca905aeeac9253e19cdf563
parentfc8a156cfc539b9c04dc3527e4fc61cb4b0b688e (diff)
mesa: added MESA_GLSL=useprog debug flag
This logs glUseProgram() calls to stderr.
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/shader/shader_api.c27
2 files changed, 22 insertions, 6 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 988bfe1e228..b77dcdb7309 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2046,6 +2046,7 @@ struct gl_shader_program
#define GLSL_UNIFORMS 0x10 /**< Print glUniform calls */
#define GLSL_NOP_VERT 0x20 /**< Force no-op vertex shaders */
#define GLSL_NOP_FRAG 0x40 /**< Force no-op fragment shaders */
+#define GLSL_USE_PROG 0x80 /**< Log glUseProgram calls */
/**
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 6de97984e6d..f473bd1173b 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -390,6 +390,8 @@ get_shader_flags(void)
flags |= GLSL_OPT;
if (_mesa_strstr(env, "uniform"))
flags |= GLSL_UNIFORMS;
+ if (_mesa_strstr(env, "useprog"))
+ flags |= GLSL_USE_PROG;
}
return flags;
@@ -1524,19 +1526,32 @@ _mesa_use_program(GLcontext *ctx, GLuint program)
}
/* debug code */
- if (0) {
+ if (ctx->Shader.Flags & GLSL_USE_PROG) {
GLuint i;
- _mesa_printf("Use Shader Program %u\n", shProg->Name);
+ _mesa_printf("Mesa: glUseProgram(%u)\n", shProg->Name);
for (i = 0; i < shProg->NumShaders; i++) {
- _mesa_printf(" shader %u, type 0x%x, checksum %u\n",
+ const char *s;
+ switch (shProg->Shaders[i]->Type) {
+ case GL_VERTEX_SHADER:
+ s = "vertex";
+ break;
+ case GL_FRAGMENT_SHADER:
+ s = "fragment";
+ break;
+ case GL_GEOMETRY_SHADER:
+ s = "geometry";
+ break;
+ default:
+ s = "";
+ }
+ _mesa_printf(" %s shader %u, checksum %u\n", s,
shProg->Shaders[i]->Name,
- shProg->Shaders[i]->Type,
shProg->Shaders[i]->SourceChecksum);
}
if (shProg->VertexProgram)
- printf(" vert prog %u\n", shProg->VertexProgram->Base.Id);
+ _mesa_printf(" vert prog %u\n", shProg->VertexProgram->Base.Id);
if (shProg->FragmentProgram)
- printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id);
+ _mesa_printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id);
}
}
else {