radeon: update buffer map/unmap code for changes introduced in 92033a9516942d7272ce4b...
[mesa.git] / src / mesa / drivers / dri / radeon / radeon_maos_vbtmp.h
index 8a07a01cb21e60e7f9da53ebc0c3f2cb28101577..515783135d6f074872c3eff293fa36ff53a87a09 100644 (file)
@@ -50,13 +50,11 @@ static void TAG(emit)( GLcontext *ctx,
    GLuint rqcoordsnoswap = 0;
    GLuint (*coord)[4];
    GLuint coord_stride; /* object coordinates */
-   GLubyte dummy[4];
    int i;
 
    union emit_union *v = (union emit_union *)dest;
 
-   if (RADEON_DEBUG & DEBUG_VERTS)
-      fprintf(stderr, "%s\n", __FUNCTION__); 
+   radeon_print(RADEON_SWRENDER, RADEON_VERBOSE, "%s\n", __FUNCTION__);
 
    coord = (GLuint (*)[4])VB->ObjPtr->data;
    coord_stride = VB->ObjPtr->stride;
@@ -67,8 +65,6 @@ static void TAG(emit)( GLcontext *ctx,
         tc2 = (GLuint (*)[4])VB->TexCoordPtr[t2]->data;
         tc2_stride = VB->TexCoordPtr[t2]->stride;
         if (DO_PTEX && VB->TexCoordPtr[t2]->size < 3) {
-        /* since DO_PTEX is only true when we have 3 or more coords
-           in the first place we don't really need this right? */
            fill_tex |= (1<<2);
         }
         else if (DO_PTEX && VB->TexCoordPtr[t2]->size < 4) {
@@ -135,7 +131,7 @@ static void TAG(emit)( GLcontext *ctx,
       }
    }
 
-   if (DO_SPEC) {
+   if (DO_SPEC_OR_FOG) {
       if (VB->SecondaryColorPtr[0]) {
         spec = VB->SecondaryColorPtr[0]->data;
         spec_stride = VB->SecondaryColorPtr[0]->stride;
@@ -145,12 +141,12 @@ static void TAG(emit)( GLcontext *ctx,
       }
    }
 
-   if (DO_FOG) {
+   if (DO_SPEC_OR_FOG) {
       if (VB->FogCoordPtr) {
         fog = VB->FogCoordPtr->data;
         fog_stride = VB->FogCoordPtr->stride;
       } else {
-        fog = (GLfloat (*)[4])&dummy; fog[0][0] = 0.0F;
+        fog = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_FOG];
         fog_stride = 0;
       }
    }
@@ -204,7 +200,7 @@ static void TAG(emit)( GLcontext *ctx,
            STRIDE_4F(col, col_stride);
            v++;
         }
-        if (DO_SPEC || DO_FOG) {
+        if (DO_SPEC_OR_FOG) {
            if (DO_SPEC) {
               UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.red, spec[0][0]);
               UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.green, spec[0][1]);
@@ -212,8 +208,8 @@ static void TAG(emit)( GLcontext *ctx,
               STRIDE_4F(spec, spec_stride);
            }
            if (DO_FOG) {
-              UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.alpha, fog[0][0]);
-              fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride);
+              UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.alpha, radeonComputeFogBlendFactor(ctx, fog[0][0]));
+              STRIDE_4F(fog, fog_stride);
            }
            if (TCL_DEBUG) fprintf(stderr, "%x ", v[0].ui);
            v++;
@@ -257,6 +253,7 @@ static void TAG(emit)( GLcontext *ctx,
         if (DO_TEX2) {
            v[0].ui = tc2[0][0];
            v[1].ui = tc2[0][1];
+           if (TCL_DEBUG) fprintf(stderr, "t2: %.2f %.2f ", v[0].f, v[1].f);
            if (DO_PTEX) {
               if (fill_tex & (1<<2))
                  v[2].f = 1.0;
@@ -264,6 +261,7 @@ static void TAG(emit)( GLcontext *ctx,
                  v[2].ui = tc2[0][2];
               else
                  v[2].ui = tc2[0][3];
+              if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[2].f);
               v += 3;
            } 
            else
@@ -283,7 +281,7 @@ static void TAG(init)( void )
    if (DO_W) sz++;
    if (DO_NORM) sz += 3;
    if (DO_RGBA) sz++;
-   if (DO_SPEC || DO_FOG) sz++;
+   if (DO_SPEC_OR_FOG) sz++;
    if (DO_TEX0) sz += 2;
    if (DO_TEX0 && DO_PTEX) sz++;
    if (DO_TEX1) sz += 2;