Mesa (master): mesa: added _mesa_print_vp/p_inputs() functions (debug aids)

Brian Paul brianp at kemper.freedesktop.org
Mon Feb 1 20:13:11 UTC 2010


Module: Mesa
Branch: master
Commit: 12ffee5d58de487cd03e274f7d6f7118d9ad8206
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=12ffee5d58de487cd03e274f7d6f7118d9ad8206

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Feb  1 13:03:25 2010 -0700

mesa: added _mesa_print_vp/p_inputs() functions (debug aids)

---

 src/mesa/shader/prog_print.c |   41 +++++++++++++++++++++++++++++++++++++++++
 src/mesa/shader/prog_print.h |    6 ++++++
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c
index 9f9789e..54fd88a 100644
--- a/src/mesa/shader/prog_print.c
+++ b/src/mesa/shader/prog_print.c
@@ -150,6 +150,10 @@ arb_input_attrib_string(GLint index, GLenum progType)
       "fragment.varying[7]"
    };
 
+   /* sanity checks */
+   assert(strcmp(vertAttribs[VERT_ATTRIB_TEX0], "vertex.texcoord[0]") == 0);
+   assert(strcmp(vertAttribs[VERT_ATTRIB_GENERIC15], "vertex.attrib[15]") == 0);
+
    if (progType == GL_VERTEX_PROGRAM_ARB) {
       assert(index < sizeof(vertAttribs) / sizeof(vertAttribs[0]));
       return vertAttribs[index];
@@ -162,6 +166,43 @@ arb_input_attrib_string(GLint index, GLenum progType)
 
 
 /**
+ * Print a vertex program's InputsRead field in human-readable format.
+ * For debugging.
+ */
+void
+_mesa_print_vp_inputs(GLbitfield inputs)
+{
+   _mesa_printf("VP Inputs 0x%x: \n", inputs);
+   while (inputs) {
+      GLint attr = _mesa_ffs(inputs) - 1;
+      const char *name = arb_input_attrib_string(attr,
+                                                 GL_VERTEX_PROGRAM_ARB);
+      _mesa_printf("  %d: %s\n", attr, name);
+      inputs &= ~(1 << attr);
+   }
+}
+
+
+/**
+ * Print a fragment program's InputsRead field in human-readable format.
+ * For debugging.
+ */
+void
+_mesa_print_fp_inputs(GLbitfield inputs)
+{
+   _mesa_printf("FP Inputs 0x%x: \n", inputs);
+   while (inputs) {
+      GLint attr = _mesa_ffs(inputs) - 1;
+      const char *name = arb_input_attrib_string(attr,
+                                                 GL_FRAGMENT_PROGRAM_ARB);
+      _mesa_printf("  %d: %s\n", attr, name);
+      inputs &= ~(1 << attr);
+   }
+}
+
+
+
+/**
  * Return ARB_v/f_prog-style output attrib string.
  */
 static const char *
diff --git a/src/mesa/shader/prog_print.h b/src/mesa/shader/prog_print.h
index fc286de..9ab7456 100644
--- a/src/mesa/shader/prog_print.h
+++ b/src/mesa/shader/prog_print.h
@@ -37,6 +37,12 @@ typedef enum {
 } gl_prog_print_mode;
 
 
+extern void
+_mesa_print_vp_inputs(GLbitfield inputs);
+
+extern void
+_mesa_print_fp_inputs(GLbitfield inputs);
+
 extern const char *
 _mesa_condcode_string(GLuint condcode);
 




More information about the mesa-commit mailing list