mesa: new _mesa_append_uniforms_to_file() debug/logging function
authorBrian Paul <brianp@vmware.com>
Fri, 14 Aug 2009 17:26:20 +0000 (11:26 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 14 Aug 2009 17:27:33 +0000 (11:27 -0600)
src/mesa/shader/prog_print.c
src/mesa/shader/prog_print.h

index 20d3fdec477378ad5ec21f1b294a2d4a84638bab..1bc210995707c0e7d00ba2d2c1f7e0ffc6c5c974 100644 (file)
@@ -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);
+}
index 3da3e767cd0ba96099375fb249ba1587b90eca1f..460426fd5105a05b90d58c52797cea2ee4ab84fb 100644 (file)
@@ -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 */