mtypes.h: Modify gl_vert_result to refer to new gl_varying_slot enum.
authorPaul Berry <stereotype441@gmail.com>
Fri, 22 Feb 2013 19:49:44 +0000 (11:49 -0800)
committerPaul Berry <stereotype441@gmail.com>
Fri, 15 Mar 2013 16:24:44 +0000 (09:24 -0700)
This paves the way for eliminating the gl_vert_result enum entirely.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Brian Paul <brianp@vmware.com>
src/mesa/main/mtypes.h
src/mesa/program/prog_print.c

index 96ef416c78054e39c6eb76fc73523eb975b4039f..37cc2daa5abd47895e36d786cc9f933b3ceb11b9 100644 (file)
@@ -213,6 +213,11 @@ typedef enum
  * fragment shader inputs.
  *
  * Note that some of these values are not available to all pipeline stages.
+ *
+ * When this enum is updated, the following code must be updated too:
+ * - vertResults (in prog_print.c's arb_output_attrib_string())
+ * - _mesa_vert_result_to_frag_attrib()
+ * - _mesa_frag_attrib_to_vert_result()
  */
 typedef enum
 {
@@ -285,27 +290,27 @@ typedef enum
  */
 typedef enum
 {
-   VERT_RESULT_HPOS = 0,
-   VERT_RESULT_COL0 = 1,
-   VERT_RESULT_COL1 = 2,
-   VERT_RESULT_FOGC = 3,
-   VERT_RESULT_TEX0 = 4,
-   VERT_RESULT_TEX1 = 5,
-   VERT_RESULT_TEX2 = 6,
-   VERT_RESULT_TEX3 = 7,
-   VERT_RESULT_TEX4 = 8,
-   VERT_RESULT_TEX5 = 9,
-   VERT_RESULT_TEX6 = 10,
-   VERT_RESULT_TEX7 = 11,
-   VERT_RESULT_PSIZ = 12,
-   VERT_RESULT_BFC0 = 13,
-   VERT_RESULT_BFC1 = 14,
-   VERT_RESULT_EDGE = 15,
-   VERT_RESULT_CLIP_VERTEX = 16,
-   VERT_RESULT_CLIP_DIST0 = 17,
-   VERT_RESULT_CLIP_DIST1 = 18,
-   VERT_RESULT_VAR0 = 19,  /**< shader varying */
-   VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING)
+   VERT_RESULT_HPOS = VARYING_SLOT_POS,
+   VERT_RESULT_COL0 = VARYING_SLOT_COL0,
+   VERT_RESULT_COL1 = VARYING_SLOT_COL1,
+   VERT_RESULT_FOGC = VARYING_SLOT_FOGC,
+   VERT_RESULT_TEX0 = VARYING_SLOT_TEX0,
+   VERT_RESULT_TEX1 = VARYING_SLOT_TEX1,
+   VERT_RESULT_TEX2 = VARYING_SLOT_TEX2,
+   VERT_RESULT_TEX3 = VARYING_SLOT_TEX3,
+   VERT_RESULT_TEX4 = VARYING_SLOT_TEX4,
+   VERT_RESULT_TEX5 = VARYING_SLOT_TEX5,
+   VERT_RESULT_TEX6 = VARYING_SLOT_TEX6,
+   VERT_RESULT_TEX7 = VARYING_SLOT_TEX7,
+   VERT_RESULT_PSIZ = VARYING_SLOT_PSIZ,
+   VERT_RESULT_BFC0 = VARYING_SLOT_BFC0,
+   VERT_RESULT_BFC1 = VARYING_SLOT_BFC1,
+   VERT_RESULT_EDGE = VARYING_SLOT_EDGE,
+   VERT_RESULT_CLIP_VERTEX = VARYING_SLOT_CLIP_VERTEX,
+   VERT_RESULT_CLIP_DIST0 = VARYING_SLOT_CLIP_DIST0,
+   VERT_RESULT_CLIP_DIST1 = VARYING_SLOT_CLIP_DIST1,
+   VERT_RESULT_VAR0 = VARYING_SLOT_VAR0,  /**< shader varying */
+   VERT_RESULT_MAX = VARYING_SLOT_MAX
 } gl_vert_result;
 
 
@@ -421,12 +426,16 @@ typedef enum
 static inline int
 _mesa_vert_result_to_frag_attrib(gl_vert_result vert_result)
 {
-   if (vert_result >= VERT_RESULT_CLIP_DIST0)
-      return vert_result - VERT_RESULT_CLIP_DIST0 + FRAG_ATTRIB_CLIP_DIST0;
-   else if (vert_result <= VERT_RESULT_TEX7)
+   if (vert_result <= VERT_RESULT_TEX7)
       return vert_result;
-   else
+   else if (vert_result < VERT_RESULT_CLIP_DIST0)
+      return -1;
+   else if (vert_result <= VERT_RESULT_CLIP_DIST1)
+      return vert_result - VERT_RESULT_CLIP_DIST0 + FRAG_ATTRIB_CLIP_DIST0;
+   else if (vert_result < VERT_RESULT_VAR0)
       return -1;
+   else
+      return vert_result - VERT_RESULT_VAR0 + FRAG_ATTRIB_VAR0;
 }
 
 
@@ -443,10 +452,12 @@ _mesa_frag_attrib_to_vert_result(gl_frag_attrib frag_attrib)
 {
    if (frag_attrib <= FRAG_ATTRIB_TEX7)
       return frag_attrib;
-   else if (frag_attrib >= FRAG_ATTRIB_CLIP_DIST0)
-      return frag_attrib - FRAG_ATTRIB_CLIP_DIST0 + VERT_RESULT_CLIP_DIST0;
-   else
+   else if (frag_attrib < FRAG_ATTRIB_CLIP_DIST0)
       return -1;
+   else if (frag_attrib <= FRAG_ATTRIB_CLIP_DIST1)
+      return frag_attrib - FRAG_ATTRIB_CLIP_DIST0 + VERT_RESULT_CLIP_DIST0;
+   else /* frag_attrib >= FRAG_ATTRIB_VAR0 */
+      return frag_attrib - FRAG_ATTRIB_VAR0 + VERT_RESULT_VAR0;
 }
 
 
index 7e7e081f76b4788e707a8c9a90b8670cd71ca009..e5592cf36680dfdda1caeb65265ada1f0bf5c0d4 100644 (file)
@@ -263,6 +263,10 @@ arb_output_attrib_string(GLint index, GLenum progType)
       "result.(sixteen)", /* VERT_RESULT_CLIP_VERTEX */
       "result.(seventeen)", /* VERT_RESULT_CLIP_DIST0 */
       "result.(eighteen)", /* VERT_RESULT_CLIP_DIST1 */
+      "result.(nineteen)", /* VARYING_SLOT_PRIMITIVE_ID */
+      "result.(twenty)", /* VARYING_SLOT_LAYER */
+      "result.(twenty-one)", /* VARYING_SLOT_FACE */
+      "result.(twenty-two)", /* VARYING_SLOT_PNTC */
       "result.varying[0]",
       "result.varying[1]",
       "result.varying[2]",