summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/shader_api.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-10-23 16:31:48 -0600
committerBrian Paul <[email protected]>2009-10-23 18:31:03 -0600
commit346250b190b023b6fbd2bde5ce3ad94a8d544e20 (patch)
treeaf95e260474438a2125197a2be6e208bfc2efe45 /src/mesa/shader/shader_api.c
parent81a4d34f07d95e6a4bf6ab105efbee4fed116e55 (diff)
mesa: refactor, new print_shader_info()
Diffstat (limited to 'src/mesa/shader/shader_api.c')
-rw-r--r--src/mesa/shader/shader_api.c61
1 files changed, 36 insertions, 25 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index f473bd1173b..30fa58ea521 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -1499,6 +1499,41 @@ _mesa_link_program(GLcontext *ctx, GLuint program)
/**
+ * Print basic shader info (for debug).
+ */
+static void
+print_shader_info(const struct gl_shader_program *shProg)
+{
+ GLuint i;
+
+ _mesa_printf("Mesa: glUseProgram(%u)\n", shProg->Name);
+ for (i = 0; i < shProg->NumShaders; i++) {
+ 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]->SourceChecksum);
+ }
+ if (shProg->VertexProgram)
+ _mesa_printf(" vert prog %u\n", shProg->VertexProgram->Base.Id);
+ if (shProg->FragmentProgram)
+ _mesa_printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id);
+}
+
+
+/**
* Called via ctx->Driver.UseProgram()
*/
void
@@ -1527,31 +1562,7 @@ _mesa_use_program(GLcontext *ctx, GLuint program)
/* debug code */
if (ctx->Shader.Flags & GLSL_USE_PROG) {
- GLuint i;
- _mesa_printf("Mesa: glUseProgram(%u)\n", shProg->Name);
- for (i = 0; i < shProg->NumShaders; i++) {
- 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]->SourceChecksum);
- }
- if (shProg->VertexProgram)
- _mesa_printf(" vert prog %u\n", shProg->VertexProgram->Base.Id);
- if (shProg->FragmentProgram)
- _mesa_printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id);
+ print_shader_info(shProg);
}
}
else {