Properly configure routing - based on advice by Keith Whitwell.
authorVladimir Dergachev <volodya@freedesktop.org>
Sat, 22 Jan 2005 03:33:10 +0000 (03:33 +0000)
committerVladimir Dergachev <volodya@freedesktop.org>
Sat, 22 Jan 2005 03:33:10 +0000 (03:33 +0000)
src/mesa/drivers/dri/r300/r300_context.h
src/mesa/drivers/dri/r300/r300_emit.h
src/mesa/drivers/dri/r300/r300_render.c
src/mesa/drivers/dri/r300/r300_state.c

index 068fdfcdca47e6dada89b3c2c9cd4e7796ef4ad3..2cd7479a31d4c3ced7652b08433396cd6cda0733 100644 (file)
@@ -475,8 +475,12 @@ struct r300_depthbuffer_state {
 struct r300_vap_reg_state {
           /* input register assigments */
           int i_coords;
+          int i_normal;
           int i_color[2];
+          int i_fog;
           int i_tex[R300_MAX_TEXTURE_UNITS];
+          int i_index;
+          int i_pointsize;
        };
 
 /* Vertex shader state */
index 6433944e19059c221651fef006b1e7c2f4e7e714..65ed7ff0ec60b135e4cc0202956c0e98850140a0 100644 (file)
@@ -139,8 +139,8 @@ static __inline__ uint32_t cmdcpdelay(unsigned short count)
                cmd[cmd_written].i=(dword); \
                cmd_written++; \
                } else { \
-               fprintf(stderr, "e32 but no previous packet declaration.. Aborting! in %s::%s at line %d\n", \
-                       __FILE__, __FUNCTION__, __LINE__); \
+               fprintf(stderr, "e32 but no previous packet declaration.. Aborting! in %s::%s at line %d, cmd_written=%d cmd_reserved=%d\n", \
+                       __FILE__, __FUNCTION__, __LINE__, cmd_written, cmd_reserved); \
                exit(-1); \
                } \
        }
index 2f832d27513361ad261028a2d4d023dad27e1a80..35b67aeaa05160a2cc61ae521a5767d63dcc8279 100644 (file)
@@ -210,10 +210,12 @@ static void r300_render_immediate_primitive(r300ContextPtr rmesa,
    /* A packet cannot have more than 16383 data words.. */
    if(((end-start)*8+4*rmesa->state.texture.tc_count)>16380){
        fprintf(stderr, "%s:%s: Too many vertices to paint. Fix me !\n");
-       return;
-       }
+       return;         
+       }
 
-   start_immediate_packet(end-start, type, 8+4*rmesa->state.texture.tc_count);
+   //fprintf(stderr, "aos_count=%d start=%d end=%d\n", rmesa->state.aos_count, start, end);
+       
+   start_immediate_packet(end-start, type, 4*rmesa->state.aos_count);
 
        for(i=start;i<end;i++){
                #if 0
@@ -232,15 +234,29 @@ static void r300_render_immediate_primitive(r300ContextPtr rmesa,
                
                
                /* coordinates */
-               output_vector(VB->ObjPtr, i);
+               if(tnl->render_inputs & _TNL_BIT_POS)
+                       output_vector(VB->ObjPtr, i);
+               if(tnl->render_inputs & _TNL_BIT_NORMAL)
+                       output_vector(VB->NormalPtr, i);
                
                /* color components */
-               output_vector(VB->ColorPtr[0], i);
-               
+               if(tnl->render_inputs & _TNL_BIT_COLOR0)
+                       output_vector(VB->ColorPtr[0], i);
+               if(tnl->render_inputs & _TNL_BIT_COLOR1)
+                       output_vector(VB->ColorPtr[1], i);
+
+               if(tnl->render_inputs & _TNL_BIT_FOG)
+                       output_vector(VB->FogCoordPtr, i);
+                                       
                /* texture coordinates */
                for(k=0;k < ctx->Const.MaxTextureUnits;k++)
-                       if(ctx->Texture.Unit[k].Enabled)
+                       if(tnl->render_inputs & (_TNL_BIT_TEX0<<k))
                                output_vector(VB->TexCoordPtr[k], i);
+               
+               if(tnl->render_inputs & _TNL_BIT_INDEX)
+                       output_vector(VB->IndexPtr[0], i);
+               if(tnl->render_inputs & _TNL_BIT_POINTSIZE)
+                       output_vector(VB->PointSizePtr, i);
                }
 
 }
index 048f62572cddbaf563e4a83f291dd6e0d76ee7c6..f650a9189fa113073f98e40756e364714886b69f 100644 (file)
@@ -815,6 +815,7 @@ void r300_setup_routing(GLcontext *ctx, GLboolean immediate)
        
        #define CONFIGURE_AOS(v, o, r, f) \
                {\
+               if (RADEON_DEBUG & DEBUG_STATE)fprintf(stderr, "Enabling "#r "\n"); \
                if(immediate){ \
                        r300->state.aos[count].element_size=4; \
                        r300->state.aos[count].stride=4; \
@@ -834,11 +835,27 @@ void r300_setup_routing(GLcontext *ctx, GLboolean immediate)
        
                /* All offsets are 0 - for use by immediate mode. 
                Should change later to handle vertex buffers */
-       CONFIGURE_AOS(VB->ObjPtr, 0, i_coords, AOS_FORMAT_FLOAT);
-       CONFIGURE_AOS(VB->ColorPtr[0], 0, i_color[0], AOS_FORMAT_FLOAT_COLOR);
+       if(tnl->render_inputs & _TNL_BIT_POS)
+               CONFIGURE_AOS(VB->ObjPtr, 0, i_coords, AOS_FORMAT_FLOAT);
+       if(tnl->render_inputs & _TNL_BIT_NORMAL)
+               CONFIGURE_AOS(VB->NormalPtr, 0, i_normal, AOS_FORMAT_FLOAT);
+       
+       if(tnl->render_inputs & _TNL_BIT_COLOR0)
+               CONFIGURE_AOS(VB->ColorPtr[0], 0, i_color[0], AOS_FORMAT_FLOAT_COLOR);
+       if(tnl->render_inputs & _TNL_BIT_COLOR1)
+               CONFIGURE_AOS(VB->ColorPtr[1], 0, i_color[1], AOS_FORMAT_FLOAT_COLOR);
+
+       if(tnl->render_inputs & _TNL_BIT_FOG)
+               CONFIGURE_AOS(VB->FogCoordPtr, 0, i_fog, AOS_FORMAT_FLOAT);
+               
        for(i=0;i < ctx->Const.MaxTextureUnits;i++)
-               if(ctx->Texture.Unit[i].Enabled)
+               if(tnl->render_inputs & (_TNL_BIT_TEX0<<i))
                        CONFIGURE_AOS(VB->TexCoordPtr[i], 0, i_tex[i], AOS_FORMAT_FLOAT);
+
+       if(tnl->render_inputs & _TNL_BIT_INDEX)
+               CONFIGURE_AOS(VB->IndexPtr[0], 0, i_index, AOS_FORMAT_FLOAT);
+       if(tnl->render_inputs & _TNL_BIT_POINTSIZE)
+               CONFIGURE_AOS(VB->PointSizePtr, 0, i_pointsize, AOS_FORMAT_FLOAT);
                        
        r300->state.aos_count=count;