From 2237d136cd8f964048a4ccdc87e0ffb48af0f73d Mon Sep 17 00:00:00 2001 From: Nicolai Hähnle Date: Thu, 23 Jul 2009 22:09:11 +0200 Subject: r300/compiler: Add rc_print_program MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/mesa/shader/prog_print.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/mesa/shader/prog_print.h') diff --git a/src/mesa/shader/prog_print.h b/src/mesa/shader/prog_print.h index d55661cebb..3da3e767cd 100644 --- a/src/mesa/shader/prog_print.h +++ b/src/mesa/shader/prog_print.h @@ -56,6 +56,13 @@ _mesa_print_alu_instruction(const struct prog_instruction *inst, extern void _mesa_print_instruction(const struct prog_instruction *inst); +extern GLint +_mesa_fprint_instruction_opt(FILE *f, + const struct prog_instruction *inst, + GLint indent, + gl_prog_print_mode mode, + const struct gl_program *prog); + extern GLint _mesa_print_instruction_opt(const struct prog_instruction *inst, GLint indent, gl_prog_print_mode mode, -- cgit v1.2.3 From db598b899868ba6db8f3f525a22a45331589592e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 14 Aug 2009 11:26:20 -0600 Subject: mesa: new _mesa_append_uniforms_to_file() debug/logging function --- src/mesa/shader/prog_print.c | 31 +++++++++++++++++++++++++++++++ src/mesa/shader/prog_print.h | 3 +++ 2 files changed, 34 insertions(+) (limited to 'src/mesa/shader/prog_print.h') diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index 20d3fdec47..1bc2109957 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -958,3 +958,34 @@ _mesa_write_shader_to_file(const struct gl_shader *shader) } +/** + * Append the shader's uniform info/values to the shader log file. + * The log file will typically have been created by the + * _mesa_write_shader_to_file function. + */ +void +_mesa_append_uniforms_to_file(const struct gl_shader *shader) +{ + const char *type; + char filename[100]; + FILE *f; + + if (shader->Type == GL_FRAGMENT_SHADER) + type = "frag"; + else + type = "vert"; + + _mesa_snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type); + f = fopen(filename, "a"); /* append */ + if (!f) { + fprintf(stderr, "Unable to open %s for appending\n", filename); + return; + } + + fprintf(f, "/* First-draw parameters / constants */\n"); + fprintf(f, "/*\n"); + _mesa_fprint_parameter_list(f, shader->Program->Parameters); + fprintf(f, "*/\n"); + + fclose(f); +} diff --git a/src/mesa/shader/prog_print.h b/src/mesa/shader/prog_print.h index 3da3e767cd..460426fd51 100644 --- a/src/mesa/shader/prog_print.h +++ b/src/mesa/shader/prog_print.h @@ -86,5 +86,8 @@ _mesa_print_parameter_list(const struct gl_program_parameter_list *list); extern void _mesa_write_shader_to_file(const struct gl_shader *shader); +extern void +_mesa_append_uniforms_to_file(const struct gl_shader *shader); + #endif /* PROG_PRINT_H */ -- cgit v1.2.3 From 12199ed96ca0dd2307e9893c58300623cfa6c0ee Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 14 Aug 2009 12:57:39 -0600 Subject: mesa: also pass the GPU program to _mesa_append_uniforms_to_file() We want the post-link program at this points. --- src/mesa/shader/prog_print.c | 5 +++-- src/mesa/shader/prog_print.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mesa/shader/prog_print.h') diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index 1bc2109957..3c1c17e099 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -964,7 +964,8 @@ _mesa_write_shader_to_file(const struct gl_shader *shader) * _mesa_write_shader_to_file function. */ void -_mesa_append_uniforms_to_file(const struct gl_shader *shader) +_mesa_append_uniforms_to_file(const struct gl_shader *shader, + const struct gl_program *prog) { const char *type; char filename[100]; @@ -984,7 +985,7 @@ _mesa_append_uniforms_to_file(const struct gl_shader *shader) fprintf(f, "/* First-draw parameters / constants */\n"); fprintf(f, "/*\n"); - _mesa_fprint_parameter_list(f, shader->Program->Parameters); + _mesa_fprint_parameter_list(f, prog->Parameters); fprintf(f, "*/\n"); fclose(f); diff --git a/src/mesa/shader/prog_print.h b/src/mesa/shader/prog_print.h index 460426fd51..fc286ded54 100644 --- a/src/mesa/shader/prog_print.h +++ b/src/mesa/shader/prog_print.h @@ -87,7 +87,8 @@ extern void _mesa_write_shader_to_file(const struct gl_shader *shader); extern void -_mesa_append_uniforms_to_file(const struct gl_shader *shader); +_mesa_append_uniforms_to_file(const struct gl_shader *shader, + const struct gl_program *prog); #endif /* PROG_PRINT_H */ -- cgit v1.2.3