From: Brian Paul Date: Fri, 23 Oct 2009 22:31:48 +0000 (-0600) Subject: mesa: refactor, new print_shader_info() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=346250b190b023b6fbd2bde5ce3ad94a8d544e20;p=mesa.git mesa: refactor, new print_shader_info() --- 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 @@ -1498,6 +1498,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() */ @@ -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 {