From: Keith Whitwell Date: Mon, 1 Jun 2009 02:01:55 +0000 (-0700) Subject: mesa: fix material inputs in ffvertex_prog.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f6c8ca06f649ae1367f61eca6fb7635862bd5584;p=mesa.git mesa: fix material inputs in ffvertex_prog.c Varying material inputs were not being picked up from the same slots where the VBO code is currently placing them (GENERIC0 and above). Most often they were just being ignored. --- diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 43325b13529..b939401de10 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -48,11 +48,9 @@ struct state_key { unsigned light_color_material_mask:12; - unsigned light_material_mask:12; unsigned light_global_enabled:1; unsigned light_local_viewer:1; unsigned light_twoside:1; - unsigned light_color_material:1; unsigned material_shininess_is_zero:1; unsigned need_eye_coords:1; unsigned normalize:1; @@ -125,27 +123,6 @@ static GLuint translate_texgen( GLboolean enabled, GLenum mode ) } -/** - * Returns bitmask of flags indicating which materials are set per-vertex - * in the current VB. - * XXX get these from the VBO... - */ -static GLbitfield -tnl_get_per_vertex_materials(GLcontext *ctx) -{ - GLbitfield mask = 0x0; -#if 0 - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - GLuint i; - - for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) - if (VB->AttribPtr[i] && VB->AttribPtr[i]->stride) - mask |= 1 << (i - _TNL_FIRST_MAT); -#endif - return mask; -} - /** * Should fog be computed per-vertex? @@ -168,10 +145,11 @@ static GLboolean check_active_shininess( GLcontext *ctx, { GLuint bit = 1 << (MAT_ATTRIB_FRONT_SHININESS + side); - if (key->light_color_material_mask & bit) + if ((key->varying_vp_inputs & VERT_BIT_COLOR0) && + (key->light_color_material_mask & bit)) return GL_TRUE; - if (key->light_material_mask & bit) + if (key->varying_vp_inputs & (bit << 16)) return GL_TRUE; if (ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS + side][0] != 0.0F) @@ -216,12 +194,9 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) key->light_twoside = 1; if (ctx->Light.ColorMaterialEnabled) { - key->light_color_material = 1; key->light_color_material_mask = ctx->Light.ColorMaterialBitmask; } - key->light_material_mask = tnl_get_per_vertex_materials(ctx); - for (i = 0; i < MAX_LIGHTS; i++) { struct gl_light *light = &ctx->Light.Light[i]; @@ -481,9 +456,9 @@ static struct ureg register_param5(struct tnl_program *p, */ static struct ureg register_input( struct tnl_program *p, GLuint input ) { - /* Material attribs are passed here as inputs >= 32 - */ - if (input >= 32 || (p->state->varying_vp_inputs & (1<state->varying_vp_inputs & (1<program->Base.InputsRead |= (1<color_materials = 0; p->materials = 0; - if (p->state->light_color_material) { - p->materials = + if (p->state->varying_vp_inputs & VERT_BIT_COLOR0) { + p->materials = p->color_materials = p->state->light_color_material_mask; } - p->materials |= p->state->light_material_mask; + p->materials |= (p->state->varying_vp_inputs >> 16); } -/* XXX temporary!!! */ -#define _TNL_ATTRIB_MAT_FRONT_AMBIENT 32 - static struct ureg get_material( struct tnl_program *p, GLuint side, GLuint property ) { @@ -922,8 +894,12 @@ static struct ureg get_material( struct tnl_program *p, GLuint side, if (p->color_materials & (1<materials & (1<materials & (1<