From: Keith Whitwell Date: Fri, 10 Jun 2005 08:33:37 +0000 (+0000) Subject: Fix colormaterial flag calculations. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f6e7cfb60d3c4ceb2242cbc57c7e87c3c8e362fe;p=mesa.git Fix colormaterial flag calculations. Fix lighting alpha result. --- diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index 53e1d6f4159..e306fc89964 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -131,15 +131,16 @@ static struct state_key *make_state_key( GLcontext *ctx ) if (ctx->Light.Model.TwoSide) key->light_twoside = 1; - if (ctx->Light.ColorMaterialEnabled) + if (ctx->Light.ColorMaterialEnabled) { key->light_color_material = 1; - - if (ctx->Light.ColorMaterialBitmask) - key->light_color_material_mask = 1; + key->light_color_material_mask = ctx->Light.ColorMaterialBitmask; + _mesa_printf("ColorMaterialBitmask %x / %x\n", ctx->Light.ColorMaterialBitmask, + key->light_color_material_mask); + } for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ; i < _TNL_ATTRIB_INDEX ; i++) if (VB->AttribPtr[i]->stride) - key->light_material_mask |= 1<light_material_mask |= 1<<(i-_TNL_ATTRIB_MAT_FRONT_AMBIENT); for (i = 0; i < MAX_LIGHTS; i++) { struct gl_light *light = &ctx->Light.Light[i]; @@ -708,8 +709,7 @@ static void build_hpos( struct tnl_program *p ) static GLuint material_attrib( GLuint side, GLuint property ) { - return (_TNL_ATTRIB_MAT_FRONT_AMBIENT + - (property - STATE_AMBIENT) * 2 + + return ((property - STATE_AMBIENT) * 2 + side); } @@ -735,14 +735,14 @@ static struct ureg get_material( struct tnl_program *p, GLuint side, if (p->color_materials & (1<materials & (1<