Merge branch 'mesa_7_7_branch'
[mesa.git] / src / mesa / tnl / t_vertex_generic.c
index c399423b9ecfb3ca04b82b7f9403aea207bf8c50..99ddace73d13f1c39d2e06bea72dd71f16d3d62c 100644 (file)
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/colormac.h"
+#include "main/simple_list.h"
 #include "t_context.h"
 #include "t_vertex.h"
-#include "simple_list.h"
 
 
+#if 0
+#define DEBUG_INSERT printf("%s\n", __FUNCTION__)
+#else
+#define DEBUG_INSERT
+#endif
+
 
 /*
  * These functions take the NDC coordinates pointed to by 'in', apply the
@@ -45,7 +51,7 @@ static INLINE void insert_4f_viewport_4( const struct tnl_clipspace_attr *a, GLu
 {
    GLfloat *out = (GLfloat *)v;
    const GLfloat * const vp = a->vp;
-   
+   DEBUG_INSERT;
    out[0] = vp[0] * in[0] + vp[12];
    out[1] = vp[5] * in[1] + vp[13];
    out[2] = vp[10] * in[2] + vp[14];
@@ -57,7 +63,7 @@ static INLINE void insert_4f_viewport_3( const struct tnl_clipspace_attr *a, GLu
 {
    GLfloat *out = (GLfloat *)v;
    const GLfloat * const vp = a->vp;
-   
+   DEBUG_INSERT;
    out[0] = vp[0] * in[0] + vp[12];
    out[1] = vp[5] * in[1] + vp[13];
    out[2] = vp[10] * in[2] + vp[14];
@@ -69,7 +75,7 @@ static INLINE void insert_4f_viewport_2( const struct tnl_clipspace_attr *a, GLu
 {
    GLfloat *out = (GLfloat *)v;
    const GLfloat * const vp = a->vp;
-   
+   DEBUG_INSERT;
    out[0] = vp[0] * in[0] + vp[12];
    out[1] = vp[5] * in[1] + vp[13];
    out[2] = vp[14];
@@ -81,7 +87,7 @@ static INLINE void insert_4f_viewport_1( const struct tnl_clipspace_attr *a, GLu
 {
    GLfloat *out = (GLfloat *)v;
    const GLfloat * const vp = a->vp;
-   
+   DEBUG_INSERT;
    out[0] = vp[0] * in[0] + vp[12];
    out[1] = vp[13];
    out[2] = vp[14];
@@ -93,7 +99,7 @@ static INLINE void insert_3f_viewport_3( const struct tnl_clipspace_attr *a, GLu
 {
    GLfloat *out = (GLfloat *)v;
    const GLfloat * const vp = a->vp;
-   
+   DEBUG_INSERT;
    out[0] = vp[0] * in[0] + vp[12];
    out[1] = vp[5] * in[1] + vp[13];
    out[2] = vp[10] * in[2] + vp[14];
@@ -104,10 +110,10 @@ static INLINE void insert_3f_viewport_2( const struct tnl_clipspace_attr *a, GLu
 {
    GLfloat *out = (GLfloat *)v;
    const GLfloat * const vp = a->vp;
-   
+   DEBUG_INSERT;
    out[0] = vp[0] * in[0] + vp[12];
    out[1] = vp[5] * in[1] + vp[13];
-   out[2] = vp[10] * in[2] + vp[14];
+   out[2] = vp[14];
 }
 
 static INLINE void insert_3f_viewport_1( const struct tnl_clipspace_attr *a, GLubyte *v,
@@ -115,7 +121,7 @@ static INLINE void insert_3f_viewport_1( const struct tnl_clipspace_attr *a, GLu
 {
    GLfloat *out = (GLfloat *)v;
    const GLfloat * const vp = a->vp;
-   
+   DEBUG_INSERT;
    out[0] = vp[0] * in[0] + vp[12];
    out[1] = vp[13];
    out[2] = vp[14];
@@ -126,7 +132,7 @@ static INLINE void insert_2f_viewport_2( const struct tnl_clipspace_attr *a, GLu
 {
    GLfloat *out = (GLfloat *)v;
    const GLfloat * const vp = a->vp;
-   
+   DEBUG_INSERT;
    out[0] = vp[0] * in[0] + vp[12];
    out[1] = vp[5] * in[1] + vp[13];
 }
@@ -136,7 +142,7 @@ static INLINE void insert_2f_viewport_1( const struct tnl_clipspace_attr *a, GLu
 {
    GLfloat *out = (GLfloat *)v;
    const GLfloat * const vp = a->vp;
-   
+   DEBUG_INSERT;
    out[0] = vp[0] * in[0] + vp[12];
    out[1] = vp[13];
 }
@@ -150,7 +156,7 @@ static INLINE void insert_4f_4( const struct tnl_clipspace_attr *a, GLubyte *v,
 {
    GLfloat *out = (GLfloat *)(v);
    (void) a;
-   
+   DEBUG_INSERT;
    out[0] = in[0];
    out[1] = in[1];
    out[2] = in[2];
@@ -161,7 +167,7 @@ static INLINE void insert_4f_3( const struct tnl_clipspace_attr *a, GLubyte *v,
 {
    GLfloat *out = (GLfloat *)(v);
    (void) a;
-   
+   DEBUG_INSERT;
    out[0] = in[0];
    out[1] = in[1];
    out[2] = in[2];
@@ -172,7 +178,7 @@ static INLINE void insert_4f_2( const struct tnl_clipspace_attr *a, GLubyte *v,
 {
    GLfloat *out = (GLfloat *)(v);
    (void) a;
-   
+   DEBUG_INSERT;
    out[0] = in[0];
    out[1] = in[1];
    out[2] = 0;
@@ -183,7 +189,7 @@ static INLINE void insert_4f_1( const struct tnl_clipspace_attr *a, GLubyte *v,
 {
    GLfloat *out = (GLfloat *)(v);
    (void) a;
-   
+   DEBUG_INSERT;
    out[0] = in[0];
    out[1] = 0;
    out[2] = 0;
@@ -194,7 +200,7 @@ static INLINE void insert_3f_xyw_4( const struct tnl_clipspace_attr *a, GLubyte
 {
    GLfloat *out = (GLfloat *)(v);
    (void) a;
-   
+   DEBUG_INSERT;
    out[0] = in[0];
    out[1] = in[1];
    out[2] = in[3];
@@ -203,14 +209,15 @@ static INLINE void insert_3f_xyw_4( const struct tnl_clipspace_attr *a, GLubyte
 static INLINE void insert_3f_xyw_err( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in )
 {
    (void) a; (void) v; (void) in;
-   _mesa_exit(1);
+   DEBUG_INSERT;
+   exit(1);
 }
 
 static INLINE void insert_3f_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in )
 {
    GLfloat *out = (GLfloat *)(v);
    (void) a;
-   
+   DEBUG_INSERT;
    out[0] = in[0];
    out[1] = in[1];
    out[2] = in[2];
@@ -220,7 +227,7 @@ static INLINE void insert_3f_2( const struct tnl_clipspace_attr *a, GLubyte *v,
 {
    GLfloat *out = (GLfloat *)(v);
    (void) a;
-   
+   DEBUG_INSERT;
    out[0] = in[0];
    out[1] = in[1];
    out[2] = 0;
@@ -230,7 +237,7 @@ static INLINE void insert_3f_1( const struct tnl_clipspace_attr *a, GLubyte *v,
 {
    GLfloat *out = (GLfloat *)(v);
    (void) a;
-   
+   DEBUG_INSERT;
    out[0] = in[0];
    out[1] = 0;
    out[2] = 0;
@@ -241,7 +248,7 @@ static INLINE void insert_2f_2( const struct tnl_clipspace_attr *a, GLubyte *v,
 {
    GLfloat *out = (GLfloat *)(v);
    (void) a;
-   
+   DEBUG_INSERT;
    out[0] = in[0];
    out[1] = in[1];
 }
@@ -250,7 +257,7 @@ static INLINE void insert_2f_1( const struct tnl_clipspace_attr *a, GLubyte *v,
 {
    GLfloat *out = (GLfloat *)(v);
    (void) a;
-   
+   DEBUG_INSERT;
    out[0] = in[0];
    out[1] = 0;
 }
@@ -259,12 +266,13 @@ static INLINE void insert_1f_1( const struct tnl_clipspace_attr *a, GLubyte *v,
 {
    GLfloat *out = (GLfloat *)(v);
    (void) a;
-
+   DEBUG_INSERT;
    out[0] = in[0];
 }
 
 static INLINE void insert_null( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a; (void) v; (void) in;
 }
 
@@ -272,6 +280,7 @@ static INLINE void insert_4chan_4f_rgba_4( const struct tnl_clipspace_attr *a, G
                                  const GLfloat *in )
 {
    GLchan *c = (GLchan *)v;
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]); 
    UNCLAMPED_FLOAT_TO_CHAN(c[1], in[1]); 
@@ -283,6 +292,7 @@ static INLINE void insert_4chan_4f_rgba_3( const struct tnl_clipspace_attr *a, G
                                  const GLfloat *in )
 {
    GLchan *c = (GLchan *)v;
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]); 
    UNCLAMPED_FLOAT_TO_CHAN(c[1], in[1]); 
@@ -294,6 +304,7 @@ static INLINE void insert_4chan_4f_rgba_2( const struct tnl_clipspace_attr *a, G
                                  const GLfloat *in )
 {
    GLchan *c = (GLchan *)v;
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]); 
    UNCLAMPED_FLOAT_TO_CHAN(c[1], in[1]); 
@@ -305,6 +316,7 @@ static INLINE void insert_4chan_4f_rgba_1( const struct tnl_clipspace_attr *a, G
                                  const GLfloat *in )
 {
    GLchan *c = (GLchan *)v;
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]); 
    c[1] = 0;
@@ -315,6 +327,7 @@ static INLINE void insert_4chan_4f_rgba_1( const struct tnl_clipspace_attr *a, G
 static INLINE void insert_4ub_4f_rgba_4( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]);
@@ -325,6 +338,7 @@ static INLINE void insert_4ub_4f_rgba_4( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_rgba_3( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]);
@@ -335,6 +349,7 @@ static INLINE void insert_4ub_4f_rgba_3( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_rgba_2( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]);
@@ -345,6 +360,7 @@ static INLINE void insert_4ub_4f_rgba_2( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_rgba_1( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]);
    v[1] = 0;
@@ -355,6 +371,7 @@ static INLINE void insert_4ub_4f_rgba_1( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_bgra_4( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]);
@@ -365,6 +382,7 @@ static INLINE void insert_4ub_4f_bgra_4( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_bgra_3( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]);
@@ -375,6 +393,7 @@ static INLINE void insert_4ub_4f_bgra_3( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_bgra_2( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]);
@@ -385,6 +404,7 @@ static INLINE void insert_4ub_4f_bgra_2( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_bgra_1( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]);
    v[1] = 0;
@@ -395,6 +415,7 @@ static INLINE void insert_4ub_4f_bgra_1( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_argb_4( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]);
@@ -405,6 +426,7 @@ static INLINE void insert_4ub_4f_argb_4( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_argb_3( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]);
@@ -415,6 +437,7 @@ static INLINE void insert_4ub_4f_argb_3( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_argb_2( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]);
@@ -425,6 +448,7 @@ static INLINE void insert_4ub_4f_argb_2( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_argb_1( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[0]);
    v[2] = 0x00;
@@ -435,6 +459,7 @@ static INLINE void insert_4ub_4f_argb_1( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_abgr_4( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]);
@@ -445,6 +470,7 @@ static INLINE void insert_4ub_4f_abgr_4( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_abgr_3( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]);
@@ -455,6 +481,7 @@ static INLINE void insert_4ub_4f_abgr_3( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_abgr_2( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]);
@@ -465,6 +492,7 @@ static INLINE void insert_4ub_4f_abgr_2( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_4ub_4f_abgr_1( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[0]);
    v[2] = 0x00;
@@ -475,6 +503,7 @@ static INLINE void insert_4ub_4f_abgr_1( const struct tnl_clipspace_attr *a, GLu
 static INLINE void insert_3ub_3f_rgb_3( const struct tnl_clipspace_attr *a, GLubyte *v, 
                               const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]);
@@ -484,6 +513,7 @@ static INLINE void insert_3ub_3f_rgb_3( const struct tnl_clipspace_attr *a, GLub
 static INLINE void insert_3ub_3f_rgb_2( const struct tnl_clipspace_attr *a, GLubyte *v, 
                               const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]);
@@ -493,6 +523,7 @@ static INLINE void insert_3ub_3f_rgb_2( const struct tnl_clipspace_attr *a, GLub
 static INLINE void insert_3ub_3f_rgb_1( const struct tnl_clipspace_attr *a, GLubyte *v, 
                               const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]);
    v[1] = 0;
@@ -502,6 +533,7 @@ static INLINE void insert_3ub_3f_rgb_1( const struct tnl_clipspace_attr *a, GLub
 static INLINE void insert_3ub_3f_bgr_3( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                 const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]);
@@ -511,6 +543,7 @@ static INLINE void insert_3ub_3f_bgr_3( const struct tnl_clipspace_attr *a, GLub
 static INLINE void insert_3ub_3f_bgr_2( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                 const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]);
    UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]);
@@ -520,6 +553,7 @@ static INLINE void insert_3ub_3f_bgr_2( const struct tnl_clipspace_attr *a, GLub
 static INLINE void insert_3ub_3f_bgr_1( const struct tnl_clipspace_attr *a, GLubyte *v, 
                                 const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]);
    v[1] = 0;
@@ -530,6 +564,7 @@ static INLINE void insert_3ub_3f_bgr_1( const struct tnl_clipspace_attr *a, GLub
 static INLINE void insert_1ub_1f_1( const struct tnl_clipspace_attr *a, GLubyte *v, 
                           const GLfloat *in )
 {
+   DEBUG_INSERT;
    (void) a;
    UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]);
 }
@@ -551,6 +586,7 @@ static void extract_4f_viewport( const struct tnl_clipspace_attr *a, GLfloat *ou
    /* Although included for completeness, the position coordinate is
     * usually handled differently during clipping.
     */
+   DEBUG_INSERT;
    out[0] = (in[0] - vp[12]) / vp[0];
    out[1] = (in[1] - vp[13]) / vp[5];
    out[2] = (in[2] - vp[14]) / vp[10];
@@ -562,7 +598,7 @@ static void extract_3f_viewport( const struct tnl_clipspace_attr *a, GLfloat *ou
 {
    const GLfloat *in = (const GLfloat *)v;
    const GLfloat * const vp = a->vp;
-   
+   DEBUG_INSERT;
    out[0] = (in[0] - vp[12]) / vp[0];
    out[1] = (in[1] - vp[13]) / vp[5];
    out[2] = (in[2] - vp[14]) / vp[10];
@@ -575,7 +611,7 @@ static void extract_2f_viewport( const struct tnl_clipspace_attr *a, GLfloat *ou
 {
    const GLfloat *in = (const GLfloat *)v;
    const GLfloat * const vp = a->vp;
-   
+   DEBUG_INSERT;
    out[0] = (in[0] - vp[12]) / vp[0];
    out[1] = (in[1] - vp[13]) / vp[5];
    out[2] = 0;
@@ -1056,33 +1092,33 @@ void _tnl_generic_interp_extras( GLcontext *ctx,
 {
    struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
 
-   /* If stride is zero, ColorPtr[1] is constant across the VB, so
+   /* If stride is zero, BackfaceColorPtr is constant across the VB, so
     * there is no point interpolating between two values as they will
     * be identical.  In all other cases, this value is generated by
     * t_vb_lighttmp.h and has a stride of 4 dwords.
     */
-   if (VB->ColorPtr[1] && VB->ColorPtr[1]->stride) {
-      assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat));
+   if (VB->BackfaceColorPtr && VB->BackfaceColorPtr->stride) {
+      assert(VB->BackfaceColorPtr->stride == 4 * sizeof(GLfloat));
 
       INTERP_4F( t,
-                VB->ColorPtr[1]->data[dst],
-                VB->ColorPtr[1]->data[out],
-                VB->ColorPtr[1]->data[in] );
+                VB->BackfaceColorPtr->data[dst],
+                VB->BackfaceColorPtr->data[out],
+                VB->BackfaceColorPtr->data[in] );
    }
 
-   if (VB->SecondaryColorPtr[1]) {
-      assert(VB->SecondaryColorPtr[1]->stride == 4 * sizeof(GLfloat));
+   if (VB->BackfaceSecondaryColorPtr) {
+      assert(VB->BackfaceSecondaryColorPtr->stride == 4 * sizeof(GLfloat));
       
       INTERP_3F( t,
-                VB->SecondaryColorPtr[1]->data[dst],
-                VB->SecondaryColorPtr[1]->data[out],
-                VB->SecondaryColorPtr[1]->data[in] );
+                VB->BackfaceSecondaryColorPtr->data[dst],
+                VB->BackfaceSecondaryColorPtr->data[out],
+                VB->BackfaceSecondaryColorPtr->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) {
@@ -1099,18 +1135,18 @@ void _tnl_generic_copy_pv_extras( GLcontext *ctx,
 
    /* See above comment:
     */
-   if (VB->ColorPtr[1] && VB->ColorPtr[1]->stride) {
-      COPY_4FV( VB->ColorPtr[1]->data[dst], 
-               VB->ColorPtr[1]->data[src] );
+   if (VB->BackfaceColorPtr && VB->BackfaceColorPtr->stride) {
+      COPY_4FV( VB->BackfaceColorPtr->data[dst],
+               VB->BackfaceColorPtr->data[src] );
    }
 
-   if (VB->SecondaryColorPtr[1]) {
-      COPY_4FV( VB->SecondaryColorPtr[1]->data[dst], 
-               VB->SecondaryColorPtr[1]->data[src] );
+   if (VB->BackfaceSecondaryColorPtr) {
+      COPY_4FV( VB->BackfaceSecondaryColorPtr->data[dst],
+               VB->BackfaceSecondaryColorPtr->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);