secondary color fixes.
authorAapo Tahkola <aet@rasterburn.org>
Fri, 24 Mar 2006 16:33:34 +0000 (16:33 +0000)
committerAapo Tahkola <aet@rasterburn.org>
Fri, 24 Mar 2006 16:33:34 +0000 (16:33 +0000)
src/mesa/drivers/dri/r300/r300_maos.c

index c2ff9c5d983043ffb4ab485e23e2d6cd11847da0..1aa005c72071b32bd79326693630c8a5ea62a0e3 100644 (file)
@@ -377,7 +377,21 @@ void r300EmitArrays(GLcontext * ctx, GLboolean immd)
        }
 
        if (inputs & _TNL_BIT_COLOR1) {
-               CONFIGURE_AOS(i_color[1], AOS_FORMAT_FLOAT_COLOR,
+               int emitsize=4;
+
+               if (!immd) {
+                       if (VB->AttribPtr[VERT_ATTRIB_COLOR1].size == 4 &&
+                           (VB->AttribPtr[VERT_ATTRIB_COLOR1].stride != 0 ||
+                            ((float*)VB->AttribPtr[VERT_ATTRIB_COLOR1].data)[3] != 1.0)) {
+                               emitsize = 4;
+                       } else {
+                               emitsize = 3;
+                       }//emitsize = VB->AttribPtr[VERT_ATTRIB_COLOR1].size;
+               }
+               if(VB->AttribPtr[VERT_ATTRIB_COLOR1].type == GL_UNSIGNED_BYTE)
+                       emitsize = 1;
+
+               CONFIGURE_AOS(i_color[1], VB->AttribPtr[VERT_ATTRIB_COLOR1].type == GL_UNSIGNED_BYTE ? AOS_FORMAT_UBYTE : AOS_FORMAT_FLOAT_COLOR,
                                                VB->AttribPtr[VERT_ATTRIB_COLOR1],
                                                immd ? 4 : VB->AttribPtr[VERT_ATTRIB_COLOR1].size,
                                                count);