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 068fdfc..2cd7479 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 6433944..65ed7ff 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 2f832d2..35b67ae 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 048f625..f650a91 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;