mesa: remove array size so the static assert can work
[mesa.git] / src / mesa / main / state.h
index 29db08a0b95a3b50611e2efe3ffb90584ea9c6d4..29a2540926828304c4d2a10c27f81cbad34eb92f 100644 (file)
 #include "mtypes.h"
 
 extern void
-_mesa_update_state(GLcontext *ctx);
+_mesa_update_state(struct gl_context *ctx);
 
 /* As above but can only be called between _mesa_lock_context_textures() and 
  * _mesa_unlock_context_textures().
  */
 extern void
-_mesa_update_state_locked(GLcontext *ctx);
+_mesa_update_state_locked(struct gl_context *ctx);
 
 
 extern void
-_mesa_set_varying_vp_inputs(GLcontext *ctx, GLbitfield varying_inputs);
+_mesa_set_varying_vp_inputs(struct gl_context *ctx, GLbitfield64 varying_inputs);
 
 
 extern void
-_mesa_set_vp_override(GLcontext *ctx, GLboolean flag);
+_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