[Mesa-dev] [PATCH 09/12] mtypes.h: Modify gl_frag_attrib to refer to new gl_varying_slot enum.

Paul Berry stereotype441 at gmail.com
Mon Mar 11 15:51:13 PDT 2013


This paves the way for eliminating the gl_frag_attrib enum entirely.
---
 src/mesa/main/mtypes.h        | 45 ++++++++++++++++++++++---------------------
 src/mesa/program/prog_print.c | 15 +++++++++++----
 2 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d88d3d3..cc11ca9 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -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;
 }
 
 
diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c
index 8617cfb..d740bf7 100644
--- a/src/mesa/program/prog_print.c
+++ b/src/mesa/program/prog_print.c
@@ -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]",
-- 
1.8.1.5



More information about the mesa-dev mailing list