Mesa (master): tnl: Replace deprecated IndexPtr[] with AttribPtr[] or new BackfaceIndexPtr

Eric Anholt anholt at kemper.freedesktop.org
Thu Nov 19 03:17:18 PST 2009


Module: Mesa
Branch: master
Commit: fc9a2970dc539b21b035ea0a770ec69822962145
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc9a2970dc539b21b035ea0a770ec69822962145

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Nov 17 23:38:35 2009 -0800

tnl: Replace deprecated IndexPtr[] with AttribPtr[] or new BackfaceIndexPtr

---

 src/mesa/swrast_setup/ss_tritmp.h |    2 +-
 src/mesa/tnl/t_context.h          |    7 +++++--
 src/mesa/tnl/t_draw.c             |    3 +--
 src/mesa/tnl/t_vb_light.c         |    1 -
 src/mesa/tnl/t_vb_lighttmp.h      |    8 ++++----
 src/mesa/tnl/t_vertex_generic.c   |   12 ++++++------
 src/mesa/tnl_dd/t_dd_tritmp.h     |    4 ++--
 src/mesa/x86/gen_matypes.c        |    2 +-
 8 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index 724b5e9..9700cf8 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -127,7 +127,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
 		     }
 		  }
 	       } else {
-		  GLfloat *vbindex = (GLfloat *)VB->IndexPtr[1]->data;
+		  GLfloat *vbindex = (GLfloat *)VB->BackfaceIndexPtr->data;
 		  saved_index[0] = v[0]->attrib[FRAG_ATTRIB_CI][0];
 		  saved_index[1] = v[1]->attrib[FRAG_ATTRIB_CI][0];
 		  saved_index[2] = v[2]->attrib[FRAG_ATTRIB_CI][0];
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index bfba09f..b41cf93 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -198,7 +198,10 @@ struct vertex_buffer
     */
    GLuint Count;  /**< Number of vertices currently in buffer */
 
-   /* Pointers to current data.
+   /* Pointers to current data.  Most of the data is in AttribPtr -- all of
+    * it that is one of VERT_ATTRIB_X.  For things only produced by TNL,
+    * such as backface color or eye-space coordinates, they are stored
+    * here.
     * XXX some of these fields alias AttribPtr below and should be removed
     * such as FogCoordPtr, etc.
     */
@@ -211,7 +214,7 @@ struct vertex_buffer
    GLubyte     *ClipMask;		        /* _TNL_BIT_POS */
    GLfloat     *NormalLengthPtr;	        /* _TNL_BIT_NORMAL */
    GLboolean   *EdgeFlag;	                /* _TNL_BIT_EDGEFLAG */
-   GLvector4f  *IndexPtr[2];	                /* _TNL_BIT_INDEX */
+   GLvector4f  *BackfaceIndexPtr;               /* _TNL_BIT_INDEX */
    GLvector4f  *ColorPtr[2];	                /* _TNL_BIT_COLOR0 */
    GLvector4f  *SecondaryColorPtr[2];           /* _TNL_BIT_COLOR1 */
    GLvector4f  *FogCoordPtr;	                /* _TNL_BIT_FOG */
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 2a29324..8092627 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -256,8 +256,7 @@ static void bind_inputs( GLcontext *ctx,
     */
    VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0];
    VB->ColorPtr[1] = NULL;
-   VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX];
-   VB->IndexPtr[1] = NULL;
+   VB->BackfaceIndexPtr = NULL;
    VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1];
    VB->SecondaryColorPtr[1] = NULL;
    VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG];
diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
index 3604521..e72a807 100644
--- a/src/mesa/tnl/t_vb_light.c
+++ b/src/mesa/tnl/t_vb_light.c
@@ -248,7 +248,6 @@ static GLboolean run_lighting( GLcontext *ctx,
 
    VB->AttribPtr[_TNL_ATTRIB_COLOR0] = VB->ColorPtr[0];
    VB->AttribPtr[_TNL_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0];
-   VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX] = VB->IndexPtr[0];
 
    return GL_TRUE;
 }
diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h
index 124ca3c..dd117e4 100644
--- a/src/mesa/tnl/t_vb_lighttmp.h
+++ b/src/mesa/tnl/t_vb_lighttmp.h
@@ -665,14 +665,14 @@ static void TAG(light_ci)( GLcontext *ctx,
    fprintf(stderr, "%s\n", __FUNCTION__ );
 #endif
 
-   VB->IndexPtr[0] = &store->LitIndex[0];
+   VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX] = &store->LitIndex[0];
 #if IDX & LIGHT_TWOSIDE
-   VB->IndexPtr[1] = &store->LitIndex[1];
+   VB->BackfaceIndexPtr = &store->LitIndex[1];
 #endif
 
-   indexResult[0] = (GLfloat *)VB->IndexPtr[0]->data;
+   indexResult[0] = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX]->data;
 #if IDX & LIGHT_TWOSIDE
-   indexResult[1] = (GLfloat *)VB->IndexPtr[1]->data;
+   indexResult[1] = (GLfloat *)VB->BackfaceIndexPtr->data;
 #endif
 
    /* loop over vertices */
diff --git a/src/mesa/tnl/t_vertex_generic.c b/src/mesa/tnl/t_vertex_generic.c
index 9812f8c..f97ad7c 100644
--- a/src/mesa/tnl/t_vertex_generic.c
+++ b/src/mesa/tnl/t_vertex_generic.c
@@ -1115,10 +1115,10 @@ void _tnl_generic_interp_extras( GLcontext *ctx,
 		 VB->SecondaryColorPtr[1]->data[in] );
    }
    
-   if (VB->IndexPtr[1]) {
-      VB->IndexPtr[1]->data[dst][0] = LINTERP( t,
-					       VB->IndexPtr[1]->data[out][0],
-					       VB->IndexPtr[1]->data[in][0] );
+   if (VB->BackfaceIndexPtr) {
+      VB->BackfaceIndexPtr->data[dst][0] = LINTERP( t,
+					       VB->BackfaceIndexPtr->data[out][0],
+					       VB->BackfaceIndexPtr->data[in][0] );
    }
 
    if (VB->EdgeFlag) {
@@ -1145,8 +1145,8 @@ void _tnl_generic_copy_pv_extras( GLcontext *ctx,
 		VB->SecondaryColorPtr[1]->data[src] );
    }
 
-   if (VB->IndexPtr[1]) {
-      VB->IndexPtr[1]->data[dst][0] = VB->IndexPtr[1]->data[src][0];
+   if (VB->BackfaceIndexPtr) {
+      VB->BackfaceIndexPtr->data[dst][0] = VB->BackfaceIndexPtr->data[src][0];
    }
 
    _tnl_generic_copy_pv(ctx, dst, src);
diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h
index 1ae70f4..0e3bc13 100644
--- a/src/mesa/tnl_dd/t_dd_tritmp.h
+++ b/src/mesa/tnl_dd/t_dd_tritmp.h
@@ -237,7 +237,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
 	       }
 	    }
 	    else {
-	       GLfloat (*vbindex) = (GLfloat *)VB->IndexPtr[1]->data;
+	       GLfloat (*vbindex) = (GLfloat *)VB->BackfaceIndexPtr->data;
 	       if (!DO_FLAT) {
 		  VERT_SAVE_IND( 0 );
 		  VERT_SAVE_IND( 1 );
@@ -506,7 +506,7 @@ static void TAG(quadr)( GLcontext *ctx,
 	       }
 	    }
 	    else {
-	       GLfloat *vbindex = (GLfloat *)VB->IndexPtr[1]->data;
+	       GLfloat *vbindex = (GLfloat *)VB->BackfaceIndexPtr->data;
 	       if (!DO_FLAT) {
 		  VERT_SAVE_IND( 0 );
 		  VERT_SAVE_IND( 1 );
diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c
index 61d6d16..5355c26 100644
--- a/src/mesa/x86/gen_matypes.c
+++ b/src/mesa/x86/gen_matypes.c
@@ -132,7 +132,7 @@ int main( int argc, char **argv )
    OFFSET( "VB_TEX1_COORD_PTR      ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX1] );
    OFFSET( "VB_TEX2_COORD_PTR      ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX2] );
    OFFSET( "VB_TEX3_COORD_PTR      ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX3] );
-   OFFSET( "VB_INDEX_PTR           ", struct vertex_buffer, IndexPtr );
+   OFFSET( "VB_INDEX_PTR           ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR_INDEX] );
    OFFSET( "VB_COLOR_PTR           ", struct vertex_buffer, ColorPtr );
    OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, SecondaryColorPtr );
    OFFSET( "VB_FOG_COORD_PTR       ", struct vertex_buffer, FogCoordPtr );



More information about the mesa-commit mailing list