r300: prepare for different vertex data type support
authorMaciej Cencora <m.cencora@gmail.com>
Sat, 30 May 2009 11:28:47 +0000 (13:28 +0200)
committerDave Airlie <airlied@redhat.com>
Sun, 7 Jun 2009 06:39:28 +0000 (16:39 +1000)
src/mesa/drivers/dri/r300/r300_context.h
src/mesa/drivers/dri/r300/r300_render.h
src/mesa/drivers/dri/r300/r300_state.c
src/mesa/drivers/dri/r300/r300_state.h
src/mesa/drivers/dri/r300/r300_swtcl.c
src/mesa/drivers/dri/r300/r300_swtcl.h

index 2ea064ed4529dbe1ab77f374be0cfac8a63fe0e2..7694fe4862f7e0b13ba9e43420058e700dbcab10 100644 (file)
@@ -584,16 +584,6 @@ struct r300_swtcl_info {
     */
    GLuint specoffset;
 
-   struct vertex_attribute{
-       GLuint attr;
-       GLubyte format;
-       GLubyte dst_loc;
-       GLuint swizzle;
-       GLubyte write_mask;
-   } vert_attrs[VERT_ATTRIB_MAX];
-
-   GLubyte vertex_attr_count;
-
    int sw_tcl_inputs[VERT_ATTRIB_MAX];
 };
 
@@ -605,6 +595,27 @@ struct r300_vtable {
        void (* SetupPixelShader)(GLcontext *ctx);
 };
 
+struct r300_vertex_buffer {
+       struct vertex_attribute {
+               /* generic */
+               GLubyte element;
+               GLvoid *data;
+               GLboolean free_needed;
+               GLuint stride;
+               GLuint dwords;
+               GLubyte size; /* number of components */
+
+               /* hw specific */
+               uint32_t data_type:4;
+               uint32_t dst_loc:5;
+               uint32_t _signed:1;
+               uint32_t normalize:1;
+               uint32_t swizzle:12;
+               uint32_t write_mask:4;
+       } attribs[VERT_ATTRIB_MAX];
+
+       GLubyte num_attribs;
+};
 
 /**
  * \brief R300 context structure.
@@ -632,6 +643,7 @@ struct r300_context {
        } options;
        
        struct r300_swtcl_info swtcl;
+       struct r300_vertex_buffer vbuf;
        GLboolean vap_flush_needed;
 
        uint32_t fallback;
index 940d2566e2cccd422a79ea4f87082339e13cbca4..002cd613dc9b8ed8b43d0b8665c9b8760fa162dc 100644 (file)
 #define R300_FALLBACK_INVALID_BUFFERS   (1 << 31)
 #define R300_RASTER_FALLBACK_MASK        0xffff0000
 
+#define MASK_XYZW (R300_WRITE_ENA_X | R300_WRITE_ENA_Y | R300_WRITE_ENA_Z | R300_WRITE_ENA_W)
+#define MASK_X R300_WRITE_ENA_X
+#define MASK_Y R300_WRITE_ENA_Y
+#define MASK_Z R300_WRITE_ENA_Z
+#define MASK_W R300_WRITE_ENA_W
+
 extern const struct tnl_pipeline_stage _r300_render_stage;
 
 extern const struct tnl_pipeline_stage _r300_tcl_stage;
index bbe993429bfca4021ba9c9d83c84b5ab6c3ff583..a04326fca97423c4fd189ca29ebcd9f400d32f23 100644 (file)
@@ -2216,6 +2216,64 @@ static void r500SetupPixelShader(GLcontext *ctx)
        bump_r500fp_const_count(rmesa->hw.r500fp_const.cmd, code->const_nr * 4);
 }
 
+void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten)
+{
+       r300ContextPtr rmesa = R300_CONTEXT( ctx );
+       struct vertex_attribute *attrs = rmesa->vbuf.attribs;
+       int i, j, reg_count;
+       uint32_t *vir0 = &rmesa->hw.vir[0].cmd[1];
+       uint32_t *vir1 = &rmesa->hw.vir[1].cmd[1];
+
+       for (i = 0; i < R300_VIR_CMDSIZE-1; ++i)
+               vir0[i] = vir1[i] = 0;
+
+       for (i = 0, j = 0; i < rmesa->vbuf.num_attribs; ++i) {
+               int tmp;
+
+               tmp = attrs[i].data_type | (attrs[i].dst_loc << R300_DST_VEC_LOC_SHIFT);
+               if (attrs[i]._signed)
+                       tmp |= R300_SIGNED;
+               if (attrs[i].normalize)
+                       tmp |= R300_NORMALIZE;
+
+               if (i % 2 == 0) {
+                       vir0[j] = tmp << R300_DATA_TYPE_0_SHIFT;
+                       vir1[j] = attrs[i].swizzle | (attrs[i].write_mask << R300_WRITE_ENA_SHIFT);
+               } else {
+                       vir0[j] |= tmp << R300_DATA_TYPE_1_SHIFT;
+                       vir1[j] |= (attrs[i].swizzle | (attrs[i].write_mask << R300_WRITE_ENA_SHIFT)) << R300_SWIZZLE1_SHIFT;
+                       ++j;
+               }
+       }
+
+       reg_count = (rmesa->vbuf.num_attribs + 1) >> 1;
+       if (rmesa->vbuf.num_attribs % 2 != 0) {
+               vir0[reg_count-1] |= R300_LAST_VEC << R300_DATA_TYPE_0_SHIFT;
+       } else {
+               vir0[reg_count-1] |= R300_LAST_VEC << R300_DATA_TYPE_1_SHIFT;
+       }
+
+       R300_STATECHANGE(rmesa, vir[0]);
+       R300_STATECHANGE(rmesa, vir[1]);
+       R300_STATECHANGE(rmesa, vof);
+       R300_STATECHANGE(rmesa, vic);
+
+       if (rmesa->radeon.radeonScreen->kernel_mm) {
+               rmesa->hw.vir[0].cmd[0] &= 0xC000FFFF;
+               rmesa->hw.vir[1].cmd[0] &= 0xC000FFFF;
+               rmesa->hw.vir[0].cmd[0] |= (reg_count & 0x3FFF) << 16;
+               rmesa->hw.vir[1].cmd[0] |= (reg_count & 0x3FFF) << 16;
+       } else {
+               ((drm_r300_cmd_header_t *) rmesa->hw.vir[0].cmd)->packet0.count = reg_count;
+               ((drm_r300_cmd_header_t *) rmesa->hw.vir[1].cmd)->packet0.count = reg_count;
+       }
+
+       rmesa->hw.vic.cmd[R300_VIC_CNTL_0] = r300VAPInputCntl0(ctx, InputsRead);
+       rmesa->hw.vic.cmd[R300_VIC_CNTL_1] = r300VAPInputCntl1(ctx, InputsRead);
+       rmesa->hw.vof.cmd[R300_VOF_CNTL_0] = r300VAPOutputCntl0(ctx, OutputsWritten);
+       rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = r300VAPOutputCntl1(ctx, OutputsWritten);
+}
+
 void r300UpdateShaderStates(r300ContextPtr rmesa)
 {
        GLcontext *ctx;
index cac639d7c66159c0b076e2ba9781a015d0db7afb..23282894202f3ae66e41ff4f40913a02eae793ac 100644 (file)
@@ -58,5 +58,6 @@ void r300UpdateShaderStates (r300ContextPtr rmesa);
 void r300InitState (r300ContextPtr r300);
 void r300InitStateFuncs (struct dd_function_table *functions);
 void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, GLuint output_count, GLuint temp_count);
+void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten);
 
 #endif                         /* __R300_STATE_H__ */
index 68e24dec8fa4d28cceabda70409a2d2c4c0151da..fd6312ae261512a399d5896876e31a592022bea1 100644 (file)
@@ -38,6 +38,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "r300_swtcl.h"
 #include "r300_emit.h"
 #include "r300_tex.h"
+#include "r300_render.h"
 
 #define EMIT_ATTR( ATTR, STYLE )                                       \
 do {                                                                   \
@@ -54,107 +55,28 @@ do {                                                                       \
    rmesa->radeon.swtcl.vertex_attr_count++;                                    \
 } while (0)
 
-#define ADD_ATTR(_attr, _format, _dst_loc, _swizzle, _write_mask) \
+#define ADD_ATTR(_attr, _format, _dst_loc, _swizzle, _write_mask, _normalize) \
 do { \
-       attrs[num_attrs].attr = (_attr); \
-       attrs[num_attrs].format = (_format); \
+       attrs[num_attrs].element = (_attr); \
+       attrs[num_attrs].data_type = (_format); \
        attrs[num_attrs].dst_loc = (_dst_loc); \
        attrs[num_attrs].swizzle = (_swizzle); \
        attrs[num_attrs].write_mask = (_write_mask); \
+       attrs[num_attrs]._signed = 0; \
+       attrs[num_attrs].normalize = (_normalize); \
        ++num_attrs; \
 } while (0)
 
-static void r300SwtclVAPSetup(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten, GLuint vap_out_fmt_1)
-{
-       r300ContextPtr rmesa = R300_CONTEXT( ctx );
-       struct vertex_attribute *attrs = rmesa->swtcl.vert_attrs;
-       int i, j, reg_count;
-       uint32_t *vir0 = &rmesa->hw.vir[0].cmd[1];
-       uint32_t *vir1 = &rmesa->hw.vir[1].cmd[1];
-
-       for (i = 0; i < R300_VIR_CMDSIZE-1; ++i)
-               vir0[i] = vir1[i] = 0;
-
-       for (i = 0, j = 0; i < rmesa->radeon.swtcl.vertex_attr_count; ++i) {
-               int tmp, data_format;
-               switch (attrs[i].format) {
-                       case EMIT_1F:
-                               data_format = R300_DATA_TYPE_FLOAT_1;
-                               break;
-                       case EMIT_2F:
-                               data_format = R300_DATA_TYPE_FLOAT_2;
-                               break;
-                       case EMIT_3F:
-                               data_format = R300_DATA_TYPE_FLOAT_3;
-                               break;
-                       case EMIT_4F:
-                               data_format = R300_DATA_TYPE_FLOAT_4;
-                               break;
-                       case EMIT_4UB_4F_RGBA:
-                       case EMIT_4UB_4F_ABGR:
-                               data_format = R300_DATA_TYPE_BYTE | R300_NORMALIZE;
-                               break;
-                       default:
-                               fprintf(stderr, "%s: Invalid data format type", __FUNCTION__);
-                               _mesa_exit(-1);
-                               break;
-               }
-
-               tmp = data_format | (attrs[i].dst_loc << R300_DST_VEC_LOC_SHIFT);
-               if (i % 2 == 0) {
-                       vir0[j] = tmp << R300_DATA_TYPE_0_SHIFT;
-                       vir1[j] = attrs[i].swizzle | (attrs[i].write_mask << R300_WRITE_ENA_SHIFT);
-               } else {
-                       vir0[j] |= tmp << R300_DATA_TYPE_1_SHIFT;
-                       vir1[j] |= (attrs[i].swizzle | (attrs[i].write_mask << R300_WRITE_ENA_SHIFT)) << R300_SWIZZLE1_SHIFT;
-                       ++j;
-               }
-       }
-
-       reg_count = (rmesa->radeon.swtcl.vertex_attr_count + 1) >> 1;
-       if (rmesa->radeon.swtcl.vertex_attr_count % 2 != 0) {
-               vir0[reg_count-1] |= R300_LAST_VEC << R300_DATA_TYPE_0_SHIFT;
-       } else {
-               vir0[reg_count-1] |= R300_LAST_VEC << R300_DATA_TYPE_1_SHIFT;
-       }
-
-       R300_STATECHANGE(rmesa, vir[0]);
-       R300_STATECHANGE(rmesa, vir[1]);
-       R300_STATECHANGE(rmesa, vof);
-       R300_STATECHANGE(rmesa, vic);
-
-       if (rmesa->radeon.radeonScreen->kernel_mm) {
-               rmesa->hw.vir[0].cmd[0] &= 0xC000FFFF;
-               rmesa->hw.vir[1].cmd[0] &= 0xC000FFFF;
-               rmesa->hw.vir[0].cmd[0] |= (reg_count & 0x3FFF) << 16;
-               rmesa->hw.vir[1].cmd[0] |= (reg_count & 0x3FFF) << 16;
-       } else {
-               ((drm_r300_cmd_header_t *) rmesa->hw.vir[0].cmd)->packet0.count = reg_count;
-               ((drm_r300_cmd_header_t *) rmesa->hw.vir[1].cmd)->packet0.count = reg_count;
-       }
-
-       rmesa->hw.vic.cmd[R300_VIC_CNTL_0] = r300VAPInputCntl0(ctx, InputsRead);
-       rmesa->hw.vic.cmd[R300_VIC_CNTL_1] = r300VAPInputCntl1(ctx, InputsRead);
-       rmesa->hw.vof.cmd[R300_VOF_CNTL_0] = r300VAPOutputCntl0(ctx, OutputsWritten);
-       /**
-         * Can't use r300VAPOutputCntl1 function because it assumes
-         * that all texture coords have 4 components and that's the case
-         * for HW TCL path, but not for SW TCL.
-         */
-       rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = vap_out_fmt_1;
-}
-
-
 static void r300SetVertexFormat( GLcontext *ctx )
 {
        r300ContextPtr rmesa = R300_CONTEXT( ctx );
        TNLcontext *tnl = TNL_CONTEXT(ctx);
        struct vertex_buffer *VB = &tnl->vb;
-       int first_free_tex = 0, vap_out_fmt_1 = 0;
+       int first_free_tex = 0;
        GLuint InputsRead = 0;
        GLuint OutputsWritten = 0;
        int num_attrs = 0;
-       struct vertex_attribute *attrs = rmesa->swtcl.vert_attrs;
+       struct vertex_attribute *attrs = rmesa->vbuf.attribs;
 
        rmesa->swtcl.coloroffset = rmesa->swtcl.specoffset = 0;
        rmesa->radeon.swtcl.vertex_attr_count = 0;
@@ -166,7 +88,7 @@ static void r300SetVertexFormat( GLcontext *ctx )
                InputsRead |= 1 << VERT_ATTRIB_POS;
                OutputsWritten |= 1 << VERT_RESULT_HPOS;
                EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F );
-               ADD_ATTR(VERT_ATTRIB_POS, EMIT_4F, SWTCL_OVM_POS, SWIZZLE_XYZW, MASK_XYZW);
+               ADD_ATTR(VERT_ATTRIB_POS, R300_DATA_TYPE_FLOAT_4, SWTCL_OVM_POS, SWIZZLE_XYZW, MASK_XYZW, 0);
                rmesa->swtcl.coloroffset = 4;
        }
 
@@ -175,10 +97,10 @@ static void r300SetVertexFormat( GLcontext *ctx )
                OutputsWritten |= 1 << VERT_RESULT_COL0;
 #if MESA_LITTLE_ENDIAN
                EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_RGBA );
-               ADD_ATTR(VERT_ATTRIB_COLOR0, EMIT_4UB_4F_RGBA, SWTCL_OVM_COLOR0, SWIZZLE_XYZW, MASK_XYZW);
+               ADD_ATTR(VERT_ATTRIB_COLOR0, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR0, SWIZZLE_XYZW, MASK_XYZW, 1);
 #else
                EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_ABGR );
-               ADD_ATTR(VERT_ATTRIB_COLOR0, EMIT_4UB_4F_ABGR, SWTCL_OVM_COLOR0, SWIZZLE_XYZW, MASK_XYZW);
+               ADD_ATTR(VERT_ATTRIB_COLOR0, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR0, SWIZZLE_XYZW, MASK_XYZW, 1);
 #endif
        }
 
@@ -188,10 +110,10 @@ static void r300SetVertexFormat( GLcontext *ctx )
                OutputsWritten |= 1 << VERT_RESULT_COL1;
 #if MESA_LITTLE_ENDIAN
                EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4UB_4F_RGBA );
-               ADD_ATTR(VERT_ATTRIB_COLOR1, EMIT_4UB_4F_RGBA, SWTCL_OVM_COLOR1, swiz, MASK_XYZW);
+               ADD_ATTR(VERT_ATTRIB_COLOR1, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR1, swiz, MASK_XYZW, 1);
 #else
                EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4UB_4F_ABGR );
-               ADD_ATTR(VERT_ATTRIB_COLOR1, EMIT_4UB_4F_ABGR, SWTCL_OVM_COLOR1, swiz, MASK_XYZW);
+               ADD_ATTR(VERT_ATTRIB_COLOR1, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR1, swiz, MASK_XYZW, 1);
 #endif
                rmesa->swtcl.specoffset = rmesa->swtcl.coloroffset + 1;
        }
@@ -201,20 +123,21 @@ static void r300SetVertexFormat( GLcontext *ctx )
                OutputsWritten |= 1 << VERT_RESULT_BFC0;
 #if MESA_LITTLE_ENDIAN
                EMIT_ATTR( _TNL_ATTRIB_GENERIC0, EMIT_4UB_4F_RGBA );
-               ADD_ATTR(VERT_ATTRIB_GENERIC0, EMIT_4UB_4F_RGBA, SWTCL_OVM_COLOR2, SWIZZLE_XYZW, MASK_XYZW);
+               ADD_ATTR(VERT_ATTRIB_GENERIC0, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR2, SWIZZLE_XYZW, MASK_XYZW, 1);
 #else
                EMIT_ATTR( _TNL_ATTRIB_GENERIC0, EMIT_4UB_4F_ABGR );
-               ADD_ATTR(VERT_ATTRIB_GENERIC0, EMIT_4UB_4F_ABGR, SWTCL_OVM_COLOR2, SWIZZLE_XYZW, MASK_XYZW);
+               ADD_ATTR(VERT_ATTRIB_GENERIC0, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR2, SWIZZLE_XYZW, MASK_XYZW, 1);
 #endif
                if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 )) {
+                       VB->AttribPtr[VERT_ATTRIB_GENERIC1] = VB->SecondaryColorPtr[1];
                        GLuint swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE);
                        OutputsWritten |= 1 << VERT_RESULT_BFC1;
 #if MESA_LITTLE_ENDIAN
                        EMIT_ATTR( _TNL_ATTRIB_GENERIC1, EMIT_4UB_4F_RGBA );
-                       ADD_ATTR(VERT_ATTRIB_GENERIC1, EMIT_4UB_4F_RGBA, SWTCL_OVM_COLOR3, swiz, MASK_XYZW);
+                       ADD_ATTR(VERT_ATTRIB_GENERIC1, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR3, swiz, MASK_XYZW, 1);
 #else
                        EMIT_ATTR( _TNL_ATTRIB_GENERIC1, EMIT_4UB_4F_ABGR );
-                       ADD_ATTR(VERT_ATTRIB_GENERIC1, EMIT_4UB_4F_ABGR, SWTCL_OVM_COLOR3, swiz, MASK_XYZW);
+                       ADD_ATTR(VERT_ATTRIB_GENERIC1, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR3, swiz, MASK_XYZW, 1);
 #endif
                }
        }
@@ -224,7 +147,7 @@ static void r300SetVertexFormat( GLcontext *ctx )
                InputsRead |= 1 << VERT_ATTRIB_POINT_SIZE;
                OutputsWritten |= 1 << VERT_RESULT_PSIZ;
                EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F );
-               ADD_ATTR(VERT_ATTRIB_POINT_SIZE, EMIT_1F, SWTCL_OVM_POINT_SIZE, swiz, MASK_X);
+               ADD_ATTR(VERT_ATTRIB_POINT_SIZE, R300_DATA_TYPE_FLOAT_1, SWTCL_OVM_POINT_SIZE, swiz, MASK_X, 0);
        }
 
        /**
@@ -233,24 +156,28 @@ static void r300SetVertexFormat( GLcontext *ctx )
         */
        if (RENDERINPUTS_TEST_RANGE(tnl->render_inputs_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
                int i;
-               GLuint swiz, format;
+               GLuint swiz, format, hw_format;
                for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
                        if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) )) {
                                switch (VB->TexCoordPtr[i]->size) {
                                        case 1:
                                                format = EMIT_1F;
+                                               hw_format = R300_DATA_TYPE_FLOAT_1;
                                                swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ONE);
                                                break;
                                        case 2:
                                                format = EMIT_2F;
+                                               hw_format = R300_DATA_TYPE_FLOAT_2;
                                                swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_ZERO, SWIZZLE_ONE);
                                                break;
                                        case 3:
                                                format = EMIT_3F;
+                                               hw_format = R300_DATA_TYPE_FLOAT_3;
                                                swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE);
                                                break;
                                        case 4:
                                                format = EMIT_4F;
+                                               hw_format = R300_DATA_TYPE_FLOAT_4;
                                                swiz = SWIZZLE_XYZW;
                                                break;
                                        default:
@@ -259,8 +186,7 @@ static void r300SetVertexFormat( GLcontext *ctx )
                                InputsRead |= 1 << (VERT_ATTRIB_TEX0 + i);
                                OutputsWritten |= 1 << (VERT_RESULT_TEX0 + i);
                                EMIT_ATTR(_TNL_ATTRIB_TEX(i), format);
-                               ADD_ATTR(VERT_ATTRIB_TEX0 + i, format, SWTCL_OVM_TEX(i), swiz, MASK_XYZW);
-                               vap_out_fmt_1 |= 4 << (i * 3);
+                               ADD_ATTR(VERT_ATTRIB_TEX0 + i, hw_format, SWTCL_OVM_TEX(i), swiz, MASK_XYZW, 0);
                                ++first_free_tex;
                        }
                }
@@ -276,8 +202,7 @@ static void r300SetVertexFormat( GLcontext *ctx )
                InputsRead |= 1 << (VERT_ATTRIB_TEX0 + first_free_tex);
                OutputsWritten |= 1 << (VERT_RESULT_TEX0 + first_free_tex);
                EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F );
-               ADD_ATTR(VERT_ATTRIB_POS, EMIT_4F, SWTCL_OVM_TEX(first_free_tex), SWIZZLE_XYZW, MASK_XYZW);
-               vap_out_fmt_1 |= 4 << (first_free_tex * 3);
+               ADD_ATTR(VERT_ATTRIB_POS, R300_DATA_TYPE_FLOAT_4, SWTCL_OVM_TEX(first_free_tex), SWIZZLE_XYZW, MASK_XYZW, 0);
                ++first_free_tex;
        }
 
@@ -291,12 +216,12 @@ static void r300SetVertexFormat( GLcontext *ctx )
                OutputsWritten |= 1 << VERT_RESULT_FOGC;
                GLuint swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO);
                EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F );
-               ADD_ATTR(VERT_ATTRIB_FOG, EMIT_1F, SWTCL_OVM_TEX(first_free_tex), swiz, MASK_X);
-               vap_out_fmt_1 |=  1 << (first_free_tex * 3);
+               ADD_ATTR(VERT_ATTRIB_FOG, R300_DATA_TYPE_FLOAT_1, SWTCL_OVM_TEX(first_free_tex), swiz, MASK_XYZW, 0);
        }
 
        R300_NEWPRIM(rmesa);
-       r300SwtclVAPSetup(ctx, InputsRead, OutputsWritten, vap_out_fmt_1);
+       rmesa->vbuf.num_attribs = num_attrs;
+       r300SetupVAP(ctx, InputsRead, OutputsWritten);
 
        rmesa->radeon.swtcl.vertex_size =
                _tnl_install_attrs( ctx,
index 14826f081711e1f4f2b0097ab39283434fe58e1a..cebc895c47a29f6634f1f0a4764872f1c0fe61ff 100644 (file)
@@ -39,12 +39,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "swrast/swrast.h"
 #include "r300_context.h"
 
-#define MASK_XYZW (R300_WRITE_ENA_X | R300_WRITE_ENA_Y | R300_WRITE_ENA_Z | R300_WRITE_ENA_W)
-#define MASK_X R300_WRITE_ENA_X
-#define MASK_Y R300_WRITE_ENA_Y
-#define MASK_Z R300_WRITE_ENA_Z
-#define MASK_W R300_WRITE_ENA_W
-
 /*
  * Here are definitions of OVM locations of vertex attributes for non TCL hw
  */