From: Brian Paul Date: Thu, 6 Nov 2008 22:00:01 +0000 (-0700) Subject: gallium: added st_print_shaders() function to help w/ debugging X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=678f80b347801d925c07a774faee1ed3f716de15;p=mesa.git gallium: added st_print_shaders() function to help w/ debugging --- diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 55b52c37451..af0df22dc59 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -512,3 +512,19 @@ st_translate_fragment_program(struct st_context *st, tgsi_dump( fs.tokens, 0/*TGSI_DUMP_VERBOSE*/ ); } + +/** + * Debug- print current shader text + */ +void +st_print_shaders(GLcontext *ctx) +{ + struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; + if (shProg) { + GLuint i; + for (i = 0; i < shProg->NumShaders; i++) { + printf("GLSL shader %u of %u:\n", i, shProg->NumShaders); + printf("%s\n", shProg->Shaders[i]->Source); + } + } +} diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index 078e2c42a69..e2e5eddef22 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -151,4 +151,8 @@ st_translate_vertex_program(struct st_context *st, const ubyte *fs_input_semantic_index); +extern void +st_print_shaders(GLcontext *ctx); + + #endif