r300: cleanup some of the swtcl code
authorDave Airlie <airlied@nx6125b.(none)>
Sun, 1 Jul 2007 08:40:26 +0000 (18:40 +1000)
committerDave Airlie <airlied@nx6125b.(none)>
Sun, 1 Jul 2007 08:40:26 +0000 (18:40 +1000)
src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/r300/r300_emit.c
src/mesa/drivers/dri/r300/r300_emit.h
src/mesa/drivers/dri/r300/r300_render.c
src/mesa/drivers/dri/r300/r300_swtcl.c

index 311d003633ae9ad3d32799894b257a8d942c7042..04e3fffa5df681c81014685ec60d0651d508dfb8 100644 (file)
@@ -165,7 +165,7 @@ static const struct tnl_pipeline_stage *r300_pipeline[] = {
 
        /* Else do them here.
         */
-       //      &_r300_render_stage,
+       &_r300_render_stage,
        &_tnl_render_stage,     /* FALLBACK  */
        0,
 };
index a7763bd76e67f79c2713624f7fa3251abd635382..229439dfa871e6673a544133283b0d90774b0a29 100644 (file)
@@ -239,7 +239,7 @@ static GLuint r300VAPInputRoute1Swizzle(int swizzle[4])
            (swizzle[3] << R300_INPUT_ROUTE_W_SHIFT);
 }
 
-static GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr)
+GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr)
 {
        GLuint i;
 
@@ -255,14 +255,14 @@ static GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr)
        return (nr + 1) >> 1;
 }
 
-static GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead)
+GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead)
 {
        /* No idea what this value means. I have seen other values written to
         * this register... */
        return 0x5555;
 }
 
-static GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead)
+GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead)
 {
        r300ContextPtr rmesa = R300_CONTEXT(ctx);
        GLuint i, vic_1 = 0;
@@ -286,7 +286,7 @@ static GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead)
        return vic_1;
 }
 
-static GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint OutputsWritten)
+GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint OutputsWritten)
 {
        GLuint ret = 0;
 
@@ -315,7 +315,7 @@ static GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint OutputsWritten)
        return ret;
 }
 
-static GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint OutputsWritten)
+GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint OutputsWritten)
 {
        GLuint i, ret = 0;
 
index 400e97f6f85dd73fcc9c02714e36ca55a5ac74bb..a6d69ec5ff861a85f91c6707b6f994864b447a8d 100644 (file)
@@ -229,4 +229,11 @@ extern int r300PrimitiveType(r300ContextPtr rmesa, int prim);
 extern int r300NumVerts(r300ContextPtr rmesa, int num_verts, int prim);
 
 extern void r300EmitCacheFlush(r300ContextPtr rmesa);
+
+extern GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr);
+extern GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead);
+extern GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead);
+extern GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint OutputsWritten);
+extern GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint OutputsWritten);
+
 #endif
index db935795c7995015c5e79d975d0fdb6c92407ccc..7d8defd1cd80fa8948806c0df0407f3c49bb31db 100644 (file)
@@ -371,12 +371,17 @@ static int r300Fallback(GLcontext * ctx)
 static GLboolean r300RunNonTCLRender(GLcontext * ctx,
                                     struct tnl_pipeline_stage *stage)
 {
+       r300ContextPtr rmesa = R300_CONTEXT(ctx);
+
        if (RADEON_DEBUG & DEBUG_PRIMS)
                fprintf(stderr, "%s\n", __FUNCTION__);
 
        if (r300Fallback(ctx) >= R300_FALLBACK_RAST)
                return GL_TRUE;
 
+       if (rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)
+               return GL_TRUE;
+
        return r300RunRender(ctx, stage);
 }
 
index ef3f3b347c9aa343f058fa4d2dacde4a8efbe1ef..3fc229807f56f6bc9177cda11412715dc39d00c6 100644 (file)
@@ -77,6 +77,7 @@ do {                                                                  \
    rmesa->swtcl.vertex_attr_count++;                                   \
 } while (0)
 
+/* this differs from the VIR0 in emit.c - TODO merge them using another option */
 static GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr,
                                 int *inputs, GLint * tab, GLuint nr)
 {
@@ -101,103 +102,6 @@ static GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr,
        return (nr + 1) >> 1;
 }
 
-static GLuint r300VAPInputRoute1Swizzle(int swizzle[4])
-{
-       return (swizzle[0] << R300_INPUT_ROUTE_X_SHIFT) |
-               (swizzle[1] << R300_INPUT_ROUTE_Y_SHIFT) |
-               (swizzle[2] << R300_INPUT_ROUTE_Z_SHIFT) |
-               (swizzle[3] << R300_INPUT_ROUTE_W_SHIFT);
-}
-
-static GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr)
-{
-       GLuint i;
-
-       for (i = 0; i + 1 < nr; i += 2) {
-               dst[i >> 1] = r300VAPInputRoute1Swizzle(swizzle[i]) | R300_INPUT_ROUTE_ENABLE;
-               dst[i >> 1] |= (r300VAPInputRoute1Swizzle(swizzle[i + 1]) | R300_INPUT_ROUTE_ENABLE) << 16;
-       }
-
-       if (nr & 1) {
-               dst[nr >> 1] = r300VAPInputRoute1Swizzle(swizzle[nr - 1]) | R300_INPUT_ROUTE_ENABLE;
-       }
-
-       return (nr + 1) >> 1;
-}
-
-static GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead)
-{
-       /* No idea what this value means. I have seen other values written to
-        * this register... */
-       return 0x5555;
-}
-
-static GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead)
-{
-       r300ContextPtr rmesa = R300_CONTEXT(ctx);
-       GLuint i, vic_1 = 0;
-
-       if (InputsRead & (1 << VERT_ATTRIB_POS))
-               vic_1 |= R300_INPUT_CNTL_POS;
-
-       if (InputsRead & (1 << VERT_ATTRIB_NORMAL))
-               vic_1 |= R300_INPUT_CNTL_NORMAL;
-
-       if (InputsRead & (1 << VERT_ATTRIB_COLOR0))
-               vic_1 |= R300_INPUT_CNTL_COLOR;
-
-       rmesa->state.texture.tc_count = 0;
-       for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
-               if (InputsRead & (1 << (VERT_ATTRIB_TEX0 + i))) {
-                       rmesa->state.texture.tc_count++;
-                       vic_1 |= R300_INPUT_CNTL_TC0 << i;
-               }
-
-       return vic_1;
-}
-
-static GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint OutputsWritten)
-{
-       GLuint ret = 0;
-
-       if (OutputsWritten & (1 << VERT_RESULT_HPOS))
-               ret |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
-
-       if (OutputsWritten & (1 << VERT_RESULT_COL0))
-               ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
-
-       if (OutputsWritten & (1 << VERT_RESULT_COL1))
-               ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
-
-#if 0
-       if (OutputsWritten & (1 << VERT_RESULT_BFC0))
-               ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT;
-
-       if (OutputsWritten & (1 << VERT_RESULT_BFC1))
-               ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT;
-
-       if (OutputsWritten & (1 << VERT_RESULT_FOGC)) ;
-#endif
-
-       if (OutputsWritten & (1 << VERT_RESULT_PSIZ))
-               ret |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT;
-
-       return ret;
-}
-
-static GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint OutputsWritten)
-{
-       GLuint i, ret = 0;
-
-       for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
-               if (OutputsWritten & (1 << (VERT_RESULT_TEX0 + i))) {
-                       ret |= (4 << (3 * i));
-               }
-       }
-
-       return ret;
-}
-
 static void r300SetVertexFormat( GLcontext *ctx )
 {
    r300ContextPtr rmesa = R300_CONTEXT( ctx );
@@ -659,9 +563,6 @@ static void r300ChooseRenderState( GLcontext *ctx )
    GLuint index = 0;
    GLuint flags = ctx->_TriangleCaps;
 
-   // if (!rmesa->TclFallback || rmesa->Fallback) 
-//      return;
-
    if (flags & DD_TRI_LIGHT_TWOSIDE) index |= R300_TWOSIDE_BIT;
    if (flags & DD_TRI_UNFILLED)      index |= R300_UNFILLED_BIT;