summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 988bfe1e22..b77dcdb730 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 6de97984e6..f473bd1173 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 {