mtypes.h: Modify gl_frag_attrib to refer to new gl_varying_slot enum.
authorPaul Berry <stereotype441@gmail.com>
Sat, 23 Feb 2013 16:09:27 +0000 (08:09 -0800)
committerPaul Berry <stereotype441@gmail.com>
Fri, 15 Mar 2013 16:25:46 +0000 (09:25 -0700)
This paves the way for eliminating the gl_frag_attrib 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 d88d3d355a914cf755738d19042436203bc921af..cc11ca92a2d0f276551b68e293f25f1a7fe63480 100644 (file)
@@ -216,6 +216,7 @@ typedef enum
  *
  * When this enum is updated, the following code must be updated too:
  * - vertResults (in prog_print.c's arb_output_attrib_string())
+ * - fragAttribs (in prog_print.c's arb_input_attrib_string())
  * - _mesa_vert_result_to_frag_attrib()
  * - _mesa_frag_attrib_to_vert_result()
  */
@@ -292,24 +293,24 @@ typedef enum
  */
 typedef enum
 {
-   FRAG_ATTRIB_WPOS = 0,
-   FRAG_ATTRIB_COL0 = 1,
-   FRAG_ATTRIB_COL1 = 2,
-   FRAG_ATTRIB_FOGC = 3,
-   FRAG_ATTRIB_TEX0 = 4,
-   FRAG_ATTRIB_TEX1 = 5,
-   FRAG_ATTRIB_TEX2 = 6,
-   FRAG_ATTRIB_TEX3 = 7,
-   FRAG_ATTRIB_TEX4 = 8,
-   FRAG_ATTRIB_TEX5 = 9,
-   FRAG_ATTRIB_TEX6 = 10,
-   FRAG_ATTRIB_TEX7 = 11,
-   FRAG_ATTRIB_FACE = 12,  /**< front/back face */
-   FRAG_ATTRIB_PNTC = 13,  /**< sprite/point coord */
-   FRAG_ATTRIB_CLIP_DIST0 = 14,
-   FRAG_ATTRIB_CLIP_DIST1 = 15,
-   FRAG_ATTRIB_VAR0 = 16,  /**< shader varying */
-   FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING)
+   FRAG_ATTRIB_WPOS = VARYING_SLOT_POS,
+   FRAG_ATTRIB_COL0 = VARYING_SLOT_COL0,
+   FRAG_ATTRIB_COL1 = VARYING_SLOT_COL1,
+   FRAG_ATTRIB_FOGC = VARYING_SLOT_FOGC,
+   FRAG_ATTRIB_TEX0 = VARYING_SLOT_TEX0,
+   FRAG_ATTRIB_TEX1 = VARYING_SLOT_TEX1,
+   FRAG_ATTRIB_TEX2 = VARYING_SLOT_TEX2,
+   FRAG_ATTRIB_TEX3 = VARYING_SLOT_TEX3,
+   FRAG_ATTRIB_TEX4 = VARYING_SLOT_TEX4,
+   FRAG_ATTRIB_TEX5 = VARYING_SLOT_TEX5,
+   FRAG_ATTRIB_TEX6 = VARYING_SLOT_TEX6,
+   FRAG_ATTRIB_TEX7 = VARYING_SLOT_TEX7,
+   FRAG_ATTRIB_FACE = VARYING_SLOT_FACE,  /**< front/back face */
+   FRAG_ATTRIB_PNTC = VARYING_SLOT_PNTC,  /**< sprite/point coord */
+   FRAG_ATTRIB_CLIP_DIST0 = VARYING_SLOT_CLIP_DIST0,
+   FRAG_ATTRIB_CLIP_DIST1 = VARYING_SLOT_CLIP_DIST1,
+   FRAG_ATTRIB_VAR0 = VARYING_SLOT_VAR0,  /**< shader varying */
+   FRAG_ATTRIB_MAX = VARYING_SLOT_MAX
 } gl_frag_attrib;
 
 
@@ -329,11 +330,11 @@ _mesa_vert_result_to_frag_attrib(gl_varying_slot vert_result)
    else if (vert_result < VARYING_SLOT_CLIP_DIST0)
       return -1;
    else if (vert_result <= VARYING_SLOT_CLIP_DIST1)
-      return vert_result - VARYING_SLOT_CLIP_DIST0 + FRAG_ATTRIB_CLIP_DIST0;
+      return vert_result;
    else if (vert_result < VARYING_SLOT_VAR0)
       return -1;
    else
-      return vert_result - VARYING_SLOT_VAR0 + FRAG_ATTRIB_VAR0;
+      return vert_result;
 }
 
 
@@ -352,9 +353,9 @@ _mesa_frag_attrib_to_vert_result(gl_frag_attrib frag_attrib)
    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 + VARYING_SLOT_CLIP_DIST0;
+      return frag_attrib;
    else /* frag_attrib >= FRAG_ATTRIB_VAR0 */
-      return frag_attrib - FRAG_ATTRIB_VAR0 + VARYING_SLOT_VAR0;
+      return frag_attrib;
 }
 
 
index 8617cfb577262dbff0cec9464f254cf53aa2031d..d740bf7d985c0df63706ce16dfd5fc811f5e1202 100644 (file)
@@ -139,10 +139,17 @@ arb_input_attrib_string(GLint index, GLenum progType)
       "fragment.texcoord[5]",
       "fragment.texcoord[6]",
       "fragment.texcoord[7]",
-      "fragment.(twelve)", /* FRAG_ATTRIB_FACE */
-      "fragment.(thirteen)", /* FRAG_ATTRIB_PNTC */
-      "fragment.(fourteen)", /* FRAG_ATTRIB_CLIP_DIST0 */
-      "fragment.(fifteen)", /* FRAG_ATTRIB_CLIP_DIST1 */
+      "fragment.(twelve)", /* VARYING_SLOT_PSIZ */
+      "fragment.(thirteen)", /* VARYING_SLOT_BFC0 */
+      "fragment.(fourteen)", /* VARYING_SLOT_BFC1 */
+      "fragment.(fifteen)", /* VARYING_SLOT_EDGE */
+      "fragment.(sixteen)", /* VARYING_SLOT_CLIP_VERTEX */
+      "fragment.(seventeen)", /* FRAG_ATTRIB_CLIP_DIST0 */
+      "fragment.(eighteen)", /* FRAG_ATTRIB_CLIP_DIST1 */
+      "fragment.(nineteen)", /* VARYING_SLOT_PRIMITIVE_ID */
+      "fragment.(twenty)", /* VARYING_SLOT_LAYER */
+      "fragment.(twenty-one)", /* FRAG_ATTRIB_FACE */
+      "fragment.(twenty-two)", /* FRAG_ATTRIB_PNTC */
       "fragment.varying[0]",
       "fragment.varying[1]",
       "fragment.varying[2]",