From b1a2393bb7dfa4a930d5302a4dfd6afd9034c413 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 13 Aug 2001 22:17:19 +0000 Subject: [PATCH] Fix problem with colormaterial (bug #441859) --- src/mesa/tnl/t_vb_lighttmp.h | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h index 22601db..a60a140 100644 --- a/src/mesa/tnl/t_vb_lighttmp.h +++ b/src/mesa/tnl/t_vb_lighttmp.h @@ -1,4 +1,4 @@ -/* $Id: t_vb_lighttmp.h,v 1.16 2001/08/02 22:39:51 keithw Exp $ */ +/* $Id: t_vb_lighttmp.h,v 1.17 2001/08/13 22:17:19 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -36,7 +36,7 @@ # define CHECK_MATERIAL(x) (flags[x] & VERT_MATERIAL) # define CHECK_END_VB(x) (flags[x] & VERT_END_VB) # if (IDX & LIGHT_COLORMATERIAL) -# define CMSTRIDE STRIDE_F(CMcolor, (4 * sizeof(GLfloat))) +# define CMSTRIDE STRIDE_F(CMcolor, CMstride) # define CHECK_COLOR_MATERIAL(x) (flags[x] & VERT_RGBA) # define CHECK_VALIDATE(x) (flags[x] & (VERT_RGBA|VERT_MATERIAL)) # define DO_ANOTHER_NORMAL(x) \ @@ -123,7 +123,8 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, spec[1] = Bspec; if (IDX & LIGHT_COLORMATERIAL) { - if (VB->ColorPtr[0]->Type != GL_FLOAT) + if (VB->ColorPtr[0]->Type != GL_FLOAT || + VB->ColorPtr[0]->Size != 4) import_color_material( ctx, stage ); CMcolor = (GLfloat *) VB->ColorPtr[0]->Ptr; @@ -336,7 +337,8 @@ static void TAG(light_rgba)( GLcontext *ctx, color[1] = Bcolor; if (IDX & LIGHT_COLORMATERIAL) { - if (VB->ColorPtr[0]->Type != GL_FLOAT) + if (VB->ColorPtr[0]->Type != GL_FLOAT || + VB->ColorPtr[0]->Size != 4) import_color_material( ctx, stage ); CMcolor = (GLfloat *)VB->ColorPtr[0]->Ptr; @@ -543,7 +545,8 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, (void) nstride; if (IDX & LIGHT_COLORMATERIAL) { - if (VB->ColorPtr[0]->Type != GL_FLOAT) + if (VB->ColorPtr[0]->Type != GL_FLOAT || + VB->ColorPtr[0]->Size != 4) import_color_material( ctx, stage ); CMcolor = (GLfloat *)VB->ColorPtr[0]->Ptr; @@ -559,8 +562,10 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, do { - if ( CHECK_COLOR_MATERIAL(j) ) + if ( CHECK_COLOR_MATERIAL(j) ) { +/* fprintf(stderr, "colormaterial at %d (%p)\n", j, CMcolor); */ _mesa_update_color_material( ctx, CMcolor ); + } if ( CHECK_MATERIAL(j) ) _mesa_update_material( ctx, new_material[j], new_material_mask[j] ); @@ -681,7 +686,8 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]); if (IDX & LIGHT_COLORMATERIAL) { - if (VB->ColorPtr[0]->Type != GL_FLOAT) + if (VB->ColorPtr[0]->Type != GL_FLOAT || + VB->ColorPtr[0]->Size != 4) import_color_material( ctx, stage ); CMcolor = (GLfloat *)VB->ColorPtr[0]->Ptr; @@ -824,7 +830,8 @@ static void TAG(light_ci)( GLcontext *ctx, indexResult[1] = VB->IndexPtr[1]->data; if (IDX & LIGHT_COLORMATERIAL) { - if (VB->ColorPtr[0]->Type != GL_FLOAT) + if (VB->ColorPtr[0]->Type != GL_FLOAT || + VB->ColorPtr[0]->Size != 4) import_color_material( ctx, stage ); CMcolor = (GLfloat *)VB->ColorPtr[0]->Ptr; -- 2.7.4