From a164d3aee063580503e5e9a77980059d52c486d7 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 6 Jul 2007 16:51:19 -0600 Subject: [PATCH] In _swsetup_Translate(), update dest->attrib[FRAG_ATTRIB_COL0]. Also, check if we're in RGB vs. CI mode. This fixes a problem with incorrect rendering color seen with the redbook/polys demo. --- src/mesa/swrast_setup/ss_context.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c index f8a1cadfa5a..a9c7d941e5b 100644 --- a/src/mesa/swrast_setup/ss_context.c +++ b/src/mesa/swrast_setup/ss_context.c @@ -280,26 +280,29 @@ _swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest ) /** XXX try to limit these loops someday */ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) - _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0+i, + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0 + i, dest->attrib[FRAG_ATTRIB_TEX0 + i] ); for (i = 0 ; i < ctx->Const.MaxVarying ; i++) - _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_GENERIC0+i, + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_GENERIC0 + i, dest->attrib[FRAG_ATTRIB_VAR0 + i] ); - _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR0, tmp ); - /* XXX need float color FRAG_ATTRIB_COL0?? */ - UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->color, tmp ); + if (ctx->Visual.rgbMode) { + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR0, + dest->attrib[FRAG_ATTRIB_COL0] ); + UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->color, tmp ); - _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR1, tmp ); - COPY_4V(dest->attrib[FRAG_ATTRIB_COL1], tmp); + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR1, + dest->attrib[FRAG_ATTRIB_COL1]); + } + else { + _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR_INDEX, tmp ); + dest->attrib[FRAG_ATTRIB_CI][0] = tmp[0]; + } _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_FOG, tmp ); dest->attrib[FRAG_ATTRIB_FOGC][0] = tmp[0]; - _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR_INDEX, tmp ); - dest->attrib[FRAG_ATTRIB_CI][0] = tmp[0]; - /* XXX See _tnl_get_attr about pointsize ... */ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POINTSIZE, tmp ); dest->pointSize = tmp[0]; -- 2.30.2