summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/prog_print.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-08-14 11:26:20 -0600
committerBrian Paul <[email protected]>2009-08-14 11:27:33 -0600
commitdb598b899868ba6db8f3f525a22a45331589592e (patch)
tree66db3de86ef478cf4c7e01769075a8d3021b0824 /src/mesa/shader/prog_print.c
parentb6e5600bd460245afef605dbfbcf6650ff677dcb (diff)
mesa: new _mesa_append_uniforms_to_file() debug/logging function
Diffstat (limited to 'src/mesa/shader/prog_print.c')
-rw-r--r--src/mesa/shader/prog_print.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c
index 20d3fdec477..1bc21099570 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);
+}