mesa: added _mesa_print_vp/p_inputs() functions (debug aids)
authorBrian Paul <brianp@vmware.com>
Mon, 1 Feb 2010 20:03:25 +0000 (13:03 -0700)
committerBrian Paul <brianp@vmware.com>
Mon, 1 Feb 2010 20:12:53 +0000 (13:12 -0700)
src/mesa/shader/prog_print.c
src/mesa/shader/prog_print.h

index 9f9789e010c7bc778d0fa28c11d331445b999b38..54fd88ad4fba3f6ad1c66b905e5f75ed790521ba 100644 (file)
@@ -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];
@@ -161,6 +165,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.
  */
index fc286ded540e1855ccb57bc7d49e58c96382eeb3..9ab745601693572aafd601f2f8357d7ad63d3b06 100644 (file)
@@ -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);