[Mesa-dev] [PATCH 10/19] mesa: Remove support for NV_vertex_program's special attributes aliasing

Eric Anholt eric at anholt.net
Tue Oct 9 18:06:42 PDT 2012


---
 src/mesa/main/api_arrayelt.c  |   31 ++++++++++++-------------------
 src/mesa/main/arrayobj.c      |    2 --
 src/mesa/main/arrayobj.h      |   12 ------------
 src/mesa/main/mtypes.h        |    2 --
 src/mesa/vbo/vbo_context.h    |    2 --
 src/mesa/vbo/vbo_exec.h       |    1 -
 src/mesa/vbo/vbo_exec_array.c |   26 --------------------------
 src/mesa/vbo/vbo_exec_draw.c  |    5 -----
 src/mesa/vbo/vbo_save_draw.c  |    5 -----
 9 files changed, 12 insertions(+), 74 deletions(-)

diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index d530001..20b8ff4 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -1528,31 +1528,24 @@ static void _ae_update_state( struct gl_context *ctx )
    for (i = 1; i < VERT_ATTRIB_GENERIC_MAX; i++) {  /* skip zero! */
       struct gl_client_array *attribArray = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)];
       if (attribArray->Enabled) {
+         GLint intOrNorm;
          at->array = attribArray;
          /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
           * function pointer here (for float arrays) since the pointer may
           * change from one execution of _ae_ArrayElement() to
           * the next.  Doing so caused UT to break.
           */
-         if (ctx->VertexProgram._Enabled
-             && ctx->VertexProgram.Current->IsNVProgram) {
-            at->func = AttribFuncsNV[at->array->Normalized]
-                                    [at->array->Size-1]
-                                    [TYPE_IDX(at->array->Type)];
-         }
-         else {
-            GLint intOrNorm;
-            if (at->array->Integer)
-               intOrNorm = 2;
-            else if (at->array->Normalized)
-               intOrNorm = 1;
-            else
-               intOrNorm = 0;
-
-            at->func = AttribFuncsARB[intOrNorm]
-                                     [at->array->Size-1]
-                                     [TYPE_IDX(at->array->Type)];
-         }
+         if (at->array->Integer)
+            intOrNorm = 2;
+         else if (at->array->Normalized)
+            intOrNorm = 1;
+         else
+            intOrNorm = 0;
+
+         at->func = AttribFuncsARB[intOrNorm]
+            [at->array->Size-1]
+            [TYPE_IDX(at->array->Type)];
+
          at->index = i;
 	 check_vbo(actx, at->array->BufferObj);
          at++;
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 9255559..5959260 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -314,8 +314,6 @@ _mesa_update_array_object_max_element(struct gl_context *ctx,
    if (!ctx->VertexProgram._Current ||
        ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) {
       enabled = _mesa_array_object_get_enabled_ff(arrayObj);
-   } else if (ctx->VertexProgram._Current->IsNVProgram) {
-      enabled = _mesa_array_object_get_enabled_nv(arrayObj);
    } else {
       enabled = _mesa_array_object_get_enabled_arb(arrayObj);
    }
diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h
index 4f89064..dfefec2 100644
--- a/src/mesa/main/arrayobj.h
+++ b/src/mesa/main/arrayobj.h
@@ -87,18 +87,6 @@ _mesa_array_object_get_enabled_ff(const struct gl_array_object *arrayObj)
    return arrayObj->_Enabled & VERT_BIT_FF_ALL;
 }
 
-/** Returns the bitmask of all enabled arrays in nv shader mode.
- *
- *  In nv shader mode, the nv generic arrays take precedence over
- *  the legacy arrays.
- */
-static inline GLbitfield64
-_mesa_array_object_get_enabled_nv(const struct gl_array_object *arrayObj)
-{
-   GLbitfield64 enabled = arrayObj->_Enabled;
-   return enabled & ~(VERT_BIT_FF_NVALIAS & (enabled >> VERT_ATTRIB_GENERIC0));
-}
-
 /** Returns the bitmask of all enabled arrays in arb/glsl shader mode.
  *
  *  In arb/glsl shader mode all the fixed function and the arb/glsl generic
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b65c64f..2ad09c5 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -195,8 +195,6 @@ typedef enum
 #define VERT_BIT_TEX(i)          VERT_BIT(VERT_ATTRIB_TEX(i))
 #define VERT_BIT_TEX_ALL         \
    BITFIELD64_RANGE(VERT_ATTRIB_TEX(0), VERT_ATTRIB_TEX_MAX)
-#define VERT_BIT_FF_NVALIAS      \
-   BITFIELD64_RANGE(VERT_ATTRIB_POS, VERT_ATTRIB_TEX(VERT_ATTRIB_TEX_MAX))
 
 #define VERT_BIT_GENERIC_NV(i)   VERT_BIT(VERT_ATTRIB_GENERIC_NV(i))
 #define VERT_BIT_GENERIC_NV_ALL  \
diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h
index e3e37e7..c896f11 100644
--- a/src/mesa/vbo/vbo_context.h
+++ b/src/mesa/vbo/vbo_context.h
@@ -106,8 +106,6 @@ get_program_mode( struct gl_context *ctx )
       return VP_NONE;
    else if (ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram)
       return VP_NONE;
-   else if (ctx->VertexProgram._Current->IsNVProgram)
-      return VP_NV;
    else
       return VP_ARB;
 }
diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h
index 635e743..ef57a81 100644
--- a/src/mesa/vbo/vbo_exec.h
+++ b/src/mesa/vbo/vbo_exec.h
@@ -55,7 +55,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 /** Current vertex program mode */
 enum vp_mode {
    VP_NONE,   /**< fixed function */
-   VP_NV,     /**< NV vertex program */
    VP_ARB     /**< ARB vertex program or GLSL vertex shader */
 };
 
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index f0ef205..d857ac3 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -440,32 +440,6 @@ recalculate_input_bindings(struct gl_context *ctx)
       }
       break;
 
-   case VP_NV:
-      /* NV_vertex_program - attribute arrays alias and override
-       * conventional, legacy arrays.  No materials, and the generic
-       * slots are vacant.
-       */
-      for (i = 0; i < VERT_ATTRIB_FF_MAX; i++) {
-	 if (i < VERT_ATTRIB_GENERIC_MAX
-             && vertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled)
-	    inputs[i] = &vertexAttrib[VERT_ATTRIB_GENERIC(i)];
-	 else if (vertexAttrib[VERT_ATTRIB_FF(i)].Enabled)
-	    inputs[i] = &vertexAttrib[VERT_ATTRIB_FF(i)];
-	 else {
-	    inputs[i] = &vbo->currval[VBO_ATTRIB_POS+i];
-            const_inputs |= VERT_BIT_FF(i);
-         }
-      }
-
-      /* Could use just about anything, just to fill in the empty
-       * slots:
-       */
-      for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
-	 inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i];
-         const_inputs |= VERT_BIT_GENERIC(i);
-      }
-      break;
-
    case VP_ARB:
       /* GL_ARB_vertex_program or GLSL vertex shader - Only the generic[0]
        * attribute array aliases and overrides the legacy position array.  
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 15ecfc0..817af4d 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -180,12 +180,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
       }
       map = vbo->map_vp_none;
       break;
-   case VP_NV:
    case VP_ARB:
-      /* The aliasing of attributes for NV vertex programs has already
-       * occurred.  NV vertex programs cannot access material values,
-       * nor attributes greater than VERT_ATTRIB_TEX7.  
-       */
       for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
          exec->vtx.inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
       }
diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
index 8ffc96a..09b8b8a 100644
--- a/src/mesa/vbo/vbo_save_draw.c
+++ b/src/mesa/vbo/vbo_save_draw.c
@@ -152,12 +152,7 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
       }
       map = vbo->map_vp_none;
       break;
-   case VP_NV:
    case VP_ARB:
-      /* The aliasing of attributes for NV vertex programs has already
-       * occurred.  NV vertex programs cannot access material values,
-       * nor attributes greater than VERT_ATTRIB_TEX7.  
-       */
       for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
          save->inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
       }
-- 
1.7.10.4



More information about the mesa-dev mailing list