summaryrefslogtreecommitdiff
path: root/src/mesa/main/texenvprogram.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/texenvprogram.c')
-rw-r--r--src/mesa/main/texenvprogram.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 3ff30058ec..3736138b9e 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.
@@ -299,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;
}
@@ -310,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);
@@ -340,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);
@@ -417,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;
}