X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Ftexenvprogram.c;h=3736138b9ed8b6f911163f1adc59a133b3410fa8;hb=56c4226fcc54158eb7fe54eeb13539a979ec155c;hp=a3f1246c98596f7f11b3333c23b346e79a4a0d0a;hpb=c5c19919ce627b98d8aab4284da1694573bcccd4;p=mesa.git diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index a3f1246c985..3736138b9ed 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -62,6 +62,18 @@ struct texenvprog_cache_item struct texenvprog_cache_item *next; }; +static GLboolean +texenv_doing_secondary_color(GLcontext *ctx) +{ + if (ctx->Light.Enabled && + (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) + return GL_TRUE; + + if (ctx->Fog.ColorSumEnabled) + return GL_TRUE; + + return GL_FALSE; +} /** * Up to nine instructions per tex unit, plus fog, specular color. @@ -263,6 +275,7 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) { /* _NEW_PROGRAM */ const GLboolean vertexShader = (ctx->Shader.CurrentProgram && + ctx->Shader.CurrentProgram->LinkStatus && ctx->Shader.CurrentProgram->VertexProgram); const GLboolean vertexProgram = ctx->VertexProgram._Enabled; GLbitfield fp_inputs = 0x0; @@ -298,7 +311,7 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) if (ctx->Light.Enabled) { fp_inputs |= FRAG_BIT_COL0; - if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) + if (texenv_doing_secondary_color(ctx)) fp_inputs |= FRAG_BIT_COL1; } @@ -309,8 +322,10 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) /* Then look at what might be varying as a result of enabled * arrays, etc: */ - if (varying_inputs & VERT_BIT_COLOR0) fp_inputs |= FRAG_BIT_COL0; - if (varying_inputs & VERT_BIT_COLOR1) fp_inputs |= FRAG_BIT_COL1; + if (varying_inputs & VERT_BIT_COLOR0) + fp_inputs |= FRAG_BIT_COL0; + if (varying_inputs & VERT_BIT_COLOR1) + fp_inputs |= FRAG_BIT_COL1; fp_inputs |= (((varying_inputs & VERT_BIT_TEX_ANY) >> VERT_ATTRIB_TEX0) << FRAG_ATTRIB_TEX0); @@ -328,7 +343,7 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) if (vertexShader) vprog = ctx->Shader.CurrentProgram->VertexProgram; else - vprog = ctx->VertexProgram._Current; + vprog = ctx->VertexProgram.Current; vp_outputs = vprog->Base.OutputsWritten; @@ -339,8 +354,10 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) if (ctx->Point.PointSprite) vp_outputs |= FRAG_BITS_TEX_ANY; - if (vp_outputs & (1 << VERT_RESULT_COL0)) fp_inputs |= FRAG_BIT_COL0; - if (vp_outputs & (1 << VERT_RESULT_COL1)) fp_inputs |= FRAG_BIT_COL1; + if (vp_outputs & (1 << VERT_RESULT_COL0)) + fp_inputs |= FRAG_BIT_COL0; + if (vp_outputs & (1 << VERT_RESULT_COL1)) + fp_inputs |= FRAG_BIT_COL1; fp_inputs |= (((vp_outputs & VERT_RESULT_TEX_ANY) >> VERT_RESULT_TEX0) << FRAG_ATTRIB_TEX0); @@ -416,8 +433,8 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) } } - /* _DD_NEW_SEPARATE_SPECULAR */ - if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) { + /* _NEW_LIGHT | _NEW_FOG */ + if (texenv_doing_secondary_color(ctx)) { key->separate_specular = 1; inputs_referenced |= FRAG_BIT_COL1; }