and rename them.
#include "main/macros.h"
#include "main/enums.h"
#include "main/dd.h"
+#include "main/state.h"
#include "texmem.h"
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- if (RGBA_LOGICOP_ENABLED(ctx)) {
+ if (_mesa_rgba_logicop_enabled(ctx)) {
i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND |
ENABLE_LOGIC_OP_MASK);
i830->state.Ctx[I830_CTXREG_ENABLES_1] |= (DISABLE_COLOR_BLEND |
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_SPEC_ADD_MASK;
- if (NEED_SECONDARY_COLOR(ctx))
+ if (_mesa_need_secondary_color(ctx))
i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_SPEC_ADD;
else
i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_SPEC_ADD;
#include "main/macros.h"
#include "main/enums.h"
#include "main/dd.h"
+#include "main/state.h"
#include "tnl/tnl.h"
#include "tnl/t_context.h"
dw0 = i915->state.Ctx[I915_CTXREG_LIS5];
dw1 = i915->state.Ctx[I915_CTXREG_LIS6];
- if (RGBA_LOGICOP_ENABLED(ctx)) {
+ if (_mesa_rgba_logicop_enabled(ctx)) {
dw0 |= S5_LOGICOP_ENABLE;
dw1 &= ~S6_CBUF_BLEND_ENABLE;
}
COPY_4V(tmpColor, ctx->Current.RasterColor);
- if (NEED_SECONDARY_COLOR(ctx)) {
+ if (_mesa_need_secondary_color(ctx)) {
ADD_3V(tmpColor, tmpColor, ctx->Current.RasterSecondaryColor);
}
#include "main/colormac.h"
#include "main/dd.h"
#include "main/mm.h"
+#include "main/state.h"
#include "mgacontext.h"
#include "mgadd.h"
static void updateBlendLogicOp(struct gl_context *ctx)
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLboolean logicOp = RGBA_LOGICOP_ENABLED(ctx);
+ GLboolean logicOp = _mesa_rgba_logicop_enabled(ctx);
MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
mmesa->hw.blend_func = (src | dst);
FALLBACK( ctx, MGA_FALLBACK_BLEND,
- ctx->Color.BlendEnabled && !RGBA_LOGICOP_ENABLED(ctx) &&
+ ctx->Color.BlendEnabled && !_mesa_rgba_logicop_enabled(ctx) &&
mmesa->hw.blend_func == (AC_src_src_alpha_sat | AC_dst_zero) );
}
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
unsigned int specen;
- specen = NEED_SECONDARY_COLOR(ctx) ? TMC_specen_enable : 0;
+ specen = _mesa_need_secondary_color(ctx) ? TMC_specen_enable : 0;
if ( specen != mmesa->hw.specen ) {
mmesa->hw.specen = specen;
? mmesa->hw.zmode : (DC_zmode_nozcmp | DC_atype_i);
mmesa->setup.dwgctl &= DC_bop_MASK;
- mmesa->setup.dwgctl |= RGBA_LOGICOP_ENABLED(ctx)
+ mmesa->setup.dwgctl |= _mesa_rgba_logicop_enabled(ctx)
? mmesa->hw.rop : mgarop_NoBLK[ GL_COPY & 0x0f ];
mmesa->setup.alphactrl &= AC_src_MASK & AC_dst_MASK & AC_atmode_MASK
blend |= NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_FLAT;
/* Secondary color */
- if (NEED_SECONDARY_COLOR(ctx))
+ if (_mesa_need_secondary_color(ctx))
blend |= NV04_MULTITEX_TRIANGLE_BLEND_SPECULAR_ENABLE;
/* Fog. */
blend |= get_texenv_mode(GL_MODULATE);
/* Secondary color */
- if (NEED_SECONDARY_COLOR(ctx))
+ if (_mesa_need_secondary_color(ctx))
blend |= NV04_TEXTURED_TRIANGLE_BLEND_SPECULAR_ENABLE;
/* Fog. */
BEGIN_RING(chan, celsius, NV10_3D_LIGHT_MODEL, 1);
OUT_RING(chan, ((m->LocalViewer ?
NV10_3D_LIGHT_MODEL_LOCAL_VIEWER : 0) |
- (NEED_SECONDARY_COLOR(ctx) ?
+ (_mesa_need_secondary_color(ctx) ?
NV10_3D_LIGHT_MODEL_SEPARATE_SPECULAR : 0) |
(!ctx->Light.Enabled && ctx->Fog.ColorSumEnabled ?
NV10_3D_LIGHT_MODEL_VERTEX_SPECULAR : 0)));
OUT_RING(chan, ((m->LocalViewer ?
NV20_3D_LIGHT_MODEL_VIEWER_LOCAL :
NV20_3D_LIGHT_MODEL_VIEWER_NONLOCAL) |
- (NEED_SECONDARY_COLOR(ctx) ?
+ (_mesa_need_secondary_color(ctx) ?
NV20_3D_LIGHT_MODEL_SEPARATE_SPECULAR :
0)));
#include "main/enums.h"
#include "main/colormac.h"
#include "main/macros.h"
+#include "main/state.h"
#include "swrast/swrast.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint t = rmesa->setup.tex_cntl_c;
- if ( NEED_SECONDARY_COLOR( ctx ) ) {
+ if ( _mesa_need_secondary_color( ctx ) ) {
if (ctx->Light.ShadeModel == GL_FLAT) {
/* R128 can't do flat-shaded separate specular */
t &= ~R128_SPEC_LIGHT_ENABLE;
(R300_BLEND_GL_ZERO << R300_DST_BLEND_SHIFT);
int eqnA = R300_COMB_FCN_ADD_CLAMP;
- if (RGBA_LOGICOP_ENABLED(ctx) || !ctx->Color.BlendEnabled) {
+ if (_mesa_rgba_logicop_enabled(ctx) || !ctx->Color.BlendEnabled) {
r300SetBlendCntl(r300, func, eqn, 0, func, eqn);
return;
}
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
R300_STATECHANGE(r300, rop);
- if (RGBA_LOGICOP_ENABLED(ctx)) {
+ if (_mesa_rgba_logicop_enabled(ctx)) {
r300->hw.rop.cmd[1] = R300_RB3D_ROPCNTL_ROP_ENABLE |
translate_logicop(ctx->Color.LogicOp);
} else {
*/
static void r300LogicOpcode(struct gl_context *ctx, GLenum logicop)
{
- if (RGBA_LOGICOP_ENABLED(ctx))
+ if (_mesa_rgba_logicop_enabled(ctx))
r300SetLogicOpState(ctx);
}
EVERGREEN_STATECHANGE(context, cb);
- if (RGBA_LOGICOP_ENABLED(ctx) || !ctx->Color.BlendEnabled) {
+ if (_mesa_rgba_logicop_enabled(ctx) || !ctx->Color.BlendEnabled) {
SETfield(blend_reg,
BLEND_ONE, COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask);
SETfield(blend_reg,
EVERGREEN_STATECHANGE(context, cb);
- if (RGBA_LOGICOP_ENABLED(ctx))
+ if (_mesa_rgba_logicop_enabled(ctx))
SETfield(evergreen->CB_COLOR_CONTROL.u32All,
evergreen_translate_logicop(ctx->Color.LogicOp),
EG_CB_COLOR_CONTROL__ROP3_shift,
static void evergreenLogicOpcode(struct gl_context *ctx, GLenum logicop) //diff
{
- if (RGBA_LOGICOP_ENABLED(ctx))
+ if (_mesa_rgba_logicop_enabled(ctx))
evergreenSetLogicOpState(ctx);
}
R600_STATECHANGE(context, blnd);
- if (RGBA_LOGICOP_ENABLED(ctx) || !ctx->Color.BlendEnabled) {
+ if (_mesa_rgba_logicop_enabled(ctx) || !ctx->Color.BlendEnabled) {
SETfield(blend_reg,
BLEND_ONE, COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask);
SETfield(blend_reg,
R600_STATECHANGE(context, blnd);
- if (RGBA_LOGICOP_ENABLED(ctx))
+ if (_mesa_rgba_logicop_enabled(ctx))
SETfield(r700->CB_COLOR_CONTROL.u32All,
translate_logicop(ctx->Color.LogicOp), ROP3_shift, ROP3_mask);
else
*/
static void r700LogicOpcode(struct gl_context *ctx, GLenum logicop)
{
- if (RGBA_LOGICOP_ENABLED(ctx))
+ if (_mesa_rgba_logicop_enabled(ctx))
r700SetLogicOpState(ctx);
}
#include "main/context.h"
#include "main/framebuffer.h"
#include "main/simple_list.h"
+#include "main/state.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_FOGCOORDSPEC, flag);
- if (NEED_SECONDARY_COLOR(ctx)) {
+ if (_mesa_need_secondary_color(ctx)) {
assert( (p & RADEON_SPECULAR_ENABLE) != 0 );
} else {
assert( (p & RADEON_SPECULAR_ENABLE) == 0 );
#include "main/enums.h"
#include "main/macros.h"
#include "main/dd.h"
-
#include "main/mm.h"
+#include "main/state.h"
+
#include "savagedd.h"
#include "savagecontext.h"
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
uint32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui;
- if (NEED_SECONDARY_COLOR(ctx)) {
+ if (_mesa_need_secondary_color(ctx)) {
imesa->regs.s4.drawLocalCtrl.ni.specShadeEn = GL_TRUE;
} else {
imesa->regs.s4.drawLocalCtrl.ni.specShadeEn = GL_FALSE;
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
uint32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui;
- if (NEED_SECONDARY_COLOR(ctx)) {
+ if (_mesa_need_secondary_color(ctx)) {
imesa->regs.s3d.drawCtrl.ni.specShadeEn = GL_TRUE;
} else {
imesa->regs.s3d.drawCtrl.ni.specShadeEn = GL_FALSE;
#include "main/context.h"
#include "main/colormac.h"
+#include "main/state.h"
#include "swrast/swrast.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
sisContextPtr smesa = SIS_CONTEXT(ctx);
__GLSiSHardware *current = &smesa->current;
- if (NEED_SECONDARY_COLOR(ctx))
+ if (_mesa_need_secondary_color(ctx))
current->hwCapEnable |= S_ENABLE_Specular;
else
current->hwCapEnable &= ~S_ENABLE_Specular;
#include "main/context.h"
#include "main/macros.h"
+#include "main/state.h"
#include "swrast/swrast.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
sisContextPtr smesa = SIS_CONTEXT(ctx);
__GLSiSHardware *current = &smesa->current;
- if (NEED_SECONDARY_COLOR(ctx))
+ if (_mesa_need_secondary_color(ctx))
current->hwCapEnable |= MASK_SpecularEnable;
else
current->hwCapEnable &= ~MASK_SpecularEnable;
-/**
- * Is the secondary color needed?
- */
-#define NEED_SECONDARY_COLOR(CTX) \
- (((CTX)->Light.Enabled && \
- (CTX)->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) \
- || (CTX)->Fog.ColorSumEnabled \
- || ((CTX)->VertexProgram._Current && \
- ((CTX)->VertexProgram._Current != (CTX)->VertexProgram._TnlProgram) && \
- ((CTX)->VertexProgram._Current->Base.InputsRead & VERT_BIT_COLOR1)) \
- || ((CTX)->FragmentProgram._Current && \
- ((CTX)->FragmentProgram._Current != (CTX)->FragmentProgram._TexEnvProgram) && \
- ((CTX)->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL1)) \
- )
-
-
-/**
- * Is RGBA LogicOp enabled?
- */
-#define RGBA_LOGICOP_ENABLED(CTX) \
- ((CTX)->Color.ColorLogicOpEnabled || \
- ((CTX)->Color.BlendEnabled && (CTX)->Color.Blend[0].EquationRGB == GL_LOGIC_OP))
-
-
#endif /* CONTEXT_H */
static void
update_separate_specular(struct gl_context *ctx)
{
- if (NEED_SECONDARY_COLOR(ctx))
+ if (_mesa_need_secondary_color(ctx))
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
else
ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
/* This is needed to support 1.1's RGB logic ops AND
* 1.0's blending logicops.
*/
- ctx->Color._LogicOpEnabled = RGBA_LOGICOP_ENABLED(ctx);
+ ctx->Color._LogicOpEnabled = _mesa_rgba_logicop_enabled(ctx);
}
ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
if (ctx->Light.ShadeModel == GL_FLAT)
ctx->_TriangleCaps |= DD_FLATSHADE;
- if (NEED_SECONDARY_COLOR(ctx))
+ if (_mesa_need_secondary_color(ctx))
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
/*
_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;
+}
+
+
+/**
+ * Is RGBA LogicOp enabled?
+ */
+static INLINE GLboolean
+_mesa_rgba_logicop_enabled(const struct gl_context *ctx)
+{
+ return ctx->Color.ColorLogicOpEnabled ||
+ (ctx->Color.BlendEnabled && ctx->Color.Blend[0].EquationRGB == GL_LOGIC_OP);
+}
+
+
+
#endif
#include "main/colormac.h"
#include "main/macros.h"
#include "main/imports.h"
+#include "main/state.h"
#include "s_aatriangle.h"
#include "s_context.h"
#include "s_span.h"
if (ctx->Texture._EnabledCoordUnits != 0
|| ctx->FragmentProgram._Current
|| swrast->_FogEnabled
- || NEED_SECONDARY_COLOR(ctx)) {
+ || _mesa_need_secondary_color(ctx)) {
SWRAST_CONTEXT(ctx)->Triangle = general_aa_tri;
}
else {
#include "main/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
+#include "main/state.h"
#include "program/prog_instruction.h"
#include "s_aatriangle.h"
if (ctx->Texture._EnabledCoordUnits ||
ctx->FragmentProgram._Current ||
ctx->ATIFragmentShader._Enabled ||
- NEED_SECONDARY_COLOR(ctx) ||
+ _mesa_need_secondary_color(ctx) ||
swrast->_FogEnabled) {
/* Ugh, we do a _lot_ of tests to pick the best textured tri func */
const struct gl_texture_object *texObj2D;
}
else {
ASSERT(!swrast->_FogEnabled);
- ASSERT(!NEED_SECONDARY_COLOR(ctx));
+ ASSERT(!_mesa_need_secondary_color(ctx));
if (ctx->Light.ShadeModel==GL_SMOOTH) {
/* smooth shaded, no texturing, stippled or some raster ops */
#if CHAN_BITS != 8
#include "main/light.h"
#include "math/m_translate.h"
#include "math/m_xform.h"
+#include "main/state.h"
#include "tnl.h"
#include "t_context.h"
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR0 );
}
- if (NEED_SECONDARY_COLOR(ctx))
+ if (_mesa_need_secondary_color(ctx))
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 );
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {