mesa: fix signed/unsigned sscanf() warning in _mesa_override_glsl_version()
[mesa.git] / src / mesa / main / state.h
index f0eb43d8ee3da3a761b923aed59f4d01a5766568..7feeb9007ca4222f889f3fa2a779be5ee3323de8 100644 (file)
@@ -46,4 +46,30 @@ extern void
 _mesa_set_vp_override(struct gl_context *ctx, GLboolean flag);
 
 
+/**
+ * Is the secondary color needed?
+ */
+static INLINE GLboolean
+_mesa_need_secondary_color(const struct gl_context *ctx)
+{
+   if (ctx->Light.Enabled &&
+       ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
+       return GL_TRUE;
+
+   if (ctx->Fog.ColorSumEnabled)
+      return GL_TRUE;
+
+   if (ctx->VertexProgram._Current &&
+       (ctx->VertexProgram._Current != ctx->VertexProgram._TnlProgram) &&
+       (ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_COLOR1))
+      return GL_TRUE;
+
+   if (ctx->FragmentProgram._Current &&
+       (ctx->FragmentProgram._Current != ctx->FragmentProgram._TexEnvProgram) &&
+       (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL1))
+      return GL_TRUE;
+
+   return GL_FALSE;
+}
+
 #endif