Changing vb code to handle inputs correctly.
authorAapo Tahkola <aet@rasterburn.org>
Thu, 3 Feb 2005 19:43:27 +0000 (19:43 +0000)
committerAapo Tahkola <aet@rasterburn.org>
Thu, 3 Feb 2005 19:43:27 +0000 (19:43 +0000)
src/mesa/drivers/dri/r300/r300_fixed_pipelines.h
src/mesa/drivers/dri/r300/r300_render.c

index 4e1fc5c555961a626123dfea93ddd118e942e071..1dcb402b9d8b7472f59288df395c354e7fa20459 100644 (file)
@@ -234,9 +234,15 @@ static struct r300_pixel_shader_state SINGLE_TEXTURE_PIXEL_SHADER={
                                inst: { 0x00018000 }
                                },
                        alu: {
-                               length: 1,
+                               length: 2,
                                inst:   
-                                       { 
+                                       {
+/* I get misc problems without this after doing cold-reboot.
+   This would imply that alu programming is buggy. --aet */
+#if 1
+                                       PFS_NOP,
+#endif                                 
+                                                               
                                        /* What are 0's ORed with flags ? They are register numbers that
                                           just happen to be 0 */
                                        {
index 7092842e9d68080426e83de24fb10faecc211260..977855778199e54ba1b7cf8116b0abc30ef74660 100644 (file)
@@ -223,14 +223,14 @@ static void r300_render_immediate_primitive(r300ContextPtr rmesa,
        WARN_ONCE("Aeiee ! aos_count==0, while it shouldn't. Skipping rendering\n");
        return;
        }
-   
+  
    render_inputs = rmesa->state.render_inputs;
 
    if(!render_inputs){
        WARN_ONCE("Aeiee ! render_inputs==0. Skipping rendering.\n");
        return;
        }
-
+       
    start_immediate_packet(end-start, type, 4*rmesa->state.aos_count);
 
        for(i=start;i<end;i++){
@@ -390,6 +390,7 @@ static void upload_vertex_buffer(r300ContextPtr rmesa, GLcontext *ctx)
        int idx=0;
        int i,j,k;
        radeonScreenPtr rsp=rmesa->radeon.radeonScreen;
+       GLuint render_inputs;
        
        /* A hack - we don't want to overwrite vertex buffers, so we
        just use AGP space for them.. Fix me ! */
@@ -422,13 +423,37 @@ static void upload_vertex_buffer(r300ContextPtr rmesa, GLcontext *ctx)
                offset+=v->size*4*VB->Count; \
                idx++; \
                }
+               
+   render_inputs = rmesa->state.render_inputs;
 
-       UPLOAD_VECTOR(VB->ObjPtr);
-       UPLOAD_VECTOR(VB->ColorPtr[0]);
+   if(!render_inputs){
+       WARN_ONCE("Aeiee ! render_inputs==0. Skipping rendering.\n");
+       return;
+       }
+       /* coordinates */
+       if(render_inputs & _TNL_BIT_POS)
+               UPLOAD_VECTOR(VB->ObjPtr);
+       if(render_inputs & _TNL_BIT_NORMAL)
+               UPLOAD_VECTOR(VB->NormalPtr);
+       
+       /* color components */
+       if(render_inputs & _TNL_BIT_COLOR0)
+               UPLOAD_VECTOR(VB->ColorPtr[0]);
+       if(render_inputs & _TNL_BIT_COLOR1)
+               UPLOAD_VECTOR(VB->SecondaryColorPtr[0]);
+       
+       if(render_inputs & _TNL_BIT_FOG)
+               UPLOAD_VECTOR(VB->FogCoordPtr);
+       
        /* texture coordinates */
        for(k=0;k < ctx->Const.MaxTextureUnits;k++)
-               if(ctx->Texture.Unit[k].Enabled)
+               if(render_inputs & (_TNL_BIT_TEX0<<k))
                        UPLOAD_VECTOR(VB->TexCoordPtr[k]);
+       
+       if(render_inputs & _TNL_BIT_INDEX)
+               UPLOAD_VECTOR(VB->IndexPtr[0]);
+       if(render_inputs & _TNL_BIT_POINTSIZE)
+               UPLOAD_VECTOR(VB->PointSizePtr);
 
        if(idx>=R300_MAX_AOS_ARRAYS){
                fprintf(stderr, "Aieee ! Maximum AOS arrays count exceeded.. \n");