[Mesa-dev] [PATCH 06/12] Replace gl_geom_attrib enum with gl_varying_slot.

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


This patch makes the following search-and-replace changes:

gl_geom_attrib -> gl_varying_slot
GEOM_ATTRIB_* -> VARYING_SLOT_*
GEOM_BIT_* -> VARYING_BIT_*
---
 src/mesa/main/context.c             |  2 --
 src/mesa/main/mtypes.h              | 41 -------------------------------------
 src/mesa/program/program.c          |  2 +-
 src/mesa/state_tracker/st_program.c | 20 +++++++++---------
 src/mesa/state_tracker/st_program.h |  8 ++++----
 5 files changed, 15 insertions(+), 58 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 7073f4a..53a373d 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -349,7 +349,6 @@ dummy_enum_func(void)
    gl_texture_index ti = TEXTURE_2D_ARRAY_INDEX;
    gl_vert_attrib va = VERT_ATTRIB_POS;
    gl_varying_slot vs = VARYING_SLOT_POS;
-   gl_geom_attrib ga = GEOM_ATTRIB_POSITION;
    gl_geom_result gr = GEOM_RESULT_POS;
 
    (void) bi;
@@ -359,7 +358,6 @@ dummy_enum_func(void)
    (void) ti;
    (void) va;
    (void) vs;
-   (void) ga;
    (void) gr;
 }
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b39c9c5..c01d584 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -286,47 +286,6 @@ typedef enum
 /*********************************************/
 
 /**
- * Indexes for geometry program attributes.
- */
-typedef enum
-{
-   GEOM_ATTRIB_POSITION = VARYING_SLOT_POS,
-   GEOM_ATTRIB_COLOR0 = VARYING_SLOT_COL0,
-   GEOM_ATTRIB_COLOR1 = VARYING_SLOT_COL1,
-   GEOM_ATTRIB_SECONDARY_COLOR0 = VARYING_SLOT_BFC0,
-   GEOM_ATTRIB_SECONDARY_COLOR1 = VARYING_SLOT_BFC1,
-   GEOM_ATTRIB_FOG_FRAG_COORD = VARYING_SLOT_FOGC,
-   GEOM_ATTRIB_POINT_SIZE = VARYING_SLOT_PNTC,
-   GEOM_ATTRIB_CLIP_VERTEX = VARYING_SLOT_CLIP_VERTEX,
-   GEOM_ATTRIB_PRIMITIVE_ID = VARYING_SLOT_PRIMITIVE_ID,
-   GEOM_ATTRIB_TEX_COORD = VARYING_SLOT_TEX0,
-
-   GEOM_ATTRIB_VAR0 = VARYING_SLOT_VAR0,
-   GEOM_ATTRIB_MAX = VARYING_SLOT_MAX
-} gl_geom_attrib;
-
-/**
- * Bitflags for geometry attributes.
- * These are used in bitfields in many places.
- */
-/*@{*/
-#define GEOM_BIT_COLOR0      (1 << GEOM_ATTRIB_COLOR0)
-#define GEOM_BIT_COLOR1      (1 << GEOM_ATTRIB_COLOR1)
-#define GEOM_BIT_SCOLOR0     (1 << GEOM_ATTRIB_SECONDARY_COLOR0)
-#define GEOM_BIT_SCOLOR1     (1 << GEOM_ATTRIB_SECONDARY_COLOR1)
-#define GEOM_BIT_TEX_COORD   (1 << GEOM_ATTRIB_TEX_COORD)
-#define GEOM_BIT_FOG_COORD   (1 << GEOM_ATTRIB_FOG_FRAG_COORD)
-#define GEOM_BIT_POSITION    (1 << GEOM_ATTRIB_POSITION)
-#define GEOM_BIT_POINT_SIDE  (1 << GEOM_ATTRIB_POINT_SIZE)
-#define GEOM_BIT_CLIP_VERTEX (1 << GEOM_ATTRIB_CLIP_VERTEX)
-#define GEOM_BIT_PRIM_ID     (1 << GEOM_ATTRIB_PRIMITIVE_ID)
-#define GEOM_BIT_VAR0        (1 << GEOM_ATTRIB_VAR0)
-
-#define GEOM_BIT_VAR(g)  (1 << (GEOM_BIT_VAR0 + (g)))
-/*@}*/
-
-
-/**
  * Indexes for geometry program result attributes
  */
 typedef enum
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index e235d6c..5cc18d4 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -936,7 +936,7 @@ _mesa_valid_register_index(const struct gl_context *ctx,
       case MESA_SHADER_FRAGMENT:
          return index < FRAG_ATTRIB_VAR0 + (GLint) ctx->Const.MaxVarying;
       case MESA_SHADER_GEOMETRY:
-         return index < GEOM_ATTRIB_VAR0 + (GLint) ctx->Const.MaxVarying;
+         return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying;
       default:
          return GL_FALSE;
       }
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 109d421..8bc2a12 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -800,7 +800,7 @@ st_translate_geometry_program(struct st_context *st,
                               struct st_geometry_program *stgp,
                               const struct st_gp_variant_key *key)
 {
-   GLuint inputMapping[GEOM_ATTRIB_MAX];
+   GLuint inputMapping[VARYING_SLOT_MAX];
    GLuint outputMapping[GEOM_RESULT_MAX];
    struct pipe_context *pipe = st->pipe;
    GLuint attr;
@@ -844,7 +844,7 @@ st_translate_geometry_program(struct st_context *st,
     * Convert Mesa program inputs to TGSI input register semantics.
     */
    inputsRead = stgp->Base.Base.InputsRead;
-   for (attr = 0; attr < GEOM_ATTRIB_MAX; attr++) {
+   for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
       if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
          const GLuint slot = gs_num_inputs;
 
@@ -857,7 +857,7 @@ st_translate_geometry_program(struct st_context *st,
          stgp->index_to_input[vslot] = attr;
          ++vslot;
 
-         if (attr != GEOM_ATTRIB_PRIMITIVE_ID) {
+         if (attr != VARYING_SLOT_PRIMITIVE_ID) {
             gs_array_offset += 2;
          } else
             ++gs_builtin_inputs;
@@ -868,31 +868,31 @@ st_translate_geometry_program(struct st_context *st,
 #endif
 
          switch (attr) {
-         case GEOM_ATTRIB_PRIMITIVE_ID:
+         case VARYING_SLOT_PRIMITIVE_ID:
             stgp->input_semantic_name[slot] = TGSI_SEMANTIC_PRIMID;
             stgp->input_semantic_index[slot] = 0;
             break;
-         case GEOM_ATTRIB_POSITION:
+         case VARYING_SLOT_POS:
             stgp->input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
             stgp->input_semantic_index[slot] = 0;
             break;
-         case GEOM_ATTRIB_COLOR0:
+         case VARYING_SLOT_COL0:
             stgp->input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
             stgp->input_semantic_index[slot] = 0;
             break;
-         case GEOM_ATTRIB_COLOR1:
+         case VARYING_SLOT_COL1:
             stgp->input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
             stgp->input_semantic_index[slot] = 1;
             break;
-         case GEOM_ATTRIB_FOG_FRAG_COORD:
+         case VARYING_SLOT_FOGC:
             stgp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
             stgp->input_semantic_index[slot] = 0;
             break;
-         case GEOM_ATTRIB_TEX_COORD:
+         case VARYING_SLOT_TEX0:
             stgp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
             stgp->input_semantic_index[slot] = num_generic++;
             break;
-         case GEOM_ATTRIB_VAR0:
+         case VARYING_SLOT_VAR0:
             /* fall-through */
          default:
             stgp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 3be7397..c764dc9 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -198,14 +198,14 @@ struct st_geometry_program
    /** map GP input back to VP output */
    GLuint input_map[PIPE_MAX_SHADER_INPUTS];
 
-   /** maps a Mesa GEOM_ATTRIB_x to a packed TGSI input index */
-   GLuint input_to_index[GEOM_ATTRIB_MAX];
-   /** maps a TGSI input index back to a Mesa GEOM_ATTRIB_x */
+   /** maps a Mesa VARYING_SLOT_x to a packed TGSI input index */
+   GLuint input_to_index[VARYING_SLOT_MAX];
+   /** maps a TGSI input index back to a Mesa VARYING_SLOT_x */
    GLuint index_to_input[PIPE_MAX_SHADER_INPUTS];
 
    GLuint num_inputs;
 
-   GLuint input_to_slot[GEOM_ATTRIB_MAX];  /**< Maps GEOM_ATTRIB_x to slot */
+   GLuint input_to_slot[VARYING_SLOT_MAX];  /**< Maps VARYING_SLOT_x to slot */
    GLuint num_input_slots;
 
    ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
-- 
1.8.1.5



More information about the mesa-dev mailing list