Compute ctx->Color._LogicOpEnabled in one place instead of four places!

This commit is contained in:
Brian Paul 2006-07-18 19:15:40 +00:00
parent f81b1dbe37
commit 813e56db51
3 changed files with 22 additions and 30 deletions

View file

@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
* Version: 6.1
* Version: 6.5.1
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -275,13 +275,6 @@ _mesa_BlendEquation( GLenum mode )
ctx->Color.BlendEquationRGB = mode;
ctx->Color.BlendEquationA = mode;
/* This is needed to support 1.1's RGB logic ops AND
* 1.0's blending logicops.
*/
ctx->Color._LogicOpEnabled = (ctx->Color.ColorLogicOpEnabled ||
(ctx->Color.BlendEnabled &&
mode == GL_LOGIC_OP));
if (ctx->Driver.BlendEquationSeparate)
(*ctx->Driver.BlendEquationSeparate)( ctx, mode, mode );
}
@ -323,12 +316,6 @@ _mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA )
ctx->Color.BlendEquationRGB = modeRGB;
ctx->Color.BlendEquationA = modeA;
/* This is needed to support 1.1's RGB logic ops AND
* 1.0's blending logicops. This test is simplified over glBlendEquation
* because modeRGB cannot be GL_LOGIC_OP.
*/
ctx->Color._LogicOpEnabled = (ctx->Color.ColorLogicOpEnabled);
if (ctx->Driver.BlendEquationSeparate)
(*ctx->Driver.BlendEquationSeparate)( ctx, modeRGB, modeA );
}

View file

@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
* Version: 6.5
* Version: 6.5.1
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -232,12 +232,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
return;
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.BlendEnabled = state;
/* This is needed to support 1.1's RGB logic ops AND
* 1.0's blending logicops.
*/
ctx->Color._LogicOpEnabled =
(ctx->Color.ColorLogicOpEnabled ||
(state && ctx->Color.BlendEquationRGB == GL_LOGIC_OP));
break;
#if FEATURE_userclip
case GL_CLIP_PLANE0:
@ -389,12 +383,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
return;
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.ColorLogicOpEnabled = state;
/* This is needed to support 1.1's RGB logic ops AND
* 1.0's blending logicops.
*/
ctx->Color._LogicOpEnabled =
(state || (ctx->Color.BlendEnabled &&
ctx->Color.BlendEquationRGB == GL_LOGIC_OP));
break;
case GL_MAP1_COLOR_4:
if (ctx->Eval.Map1Color4 == state)

View file

@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 6.5
* Version: 6.5.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
@ -985,6 +985,20 @@ update_viewport_matrix(GLcontext *ctx)
}
/**
* Update derived color/blend/logicop state.
*/
static void
update_color(GLcontext *ctx)
{
/* This is needed to support 1.1's RGB logic ops AND
* 1.0's blending logicops.
*/
ctx->Color._LogicOpEnabled = (ctx->Color.ColorLogicOpEnabled ||
(ctx->Color.BlendEnabled &&
ctx->Color.BlendEquationRGB == GL_LOGIC_OP));
}
/**
* If __GLcontextRec::NewState is non-zero then this function \b must be called
@ -1046,6 +1060,9 @@ _mesa_update_state( GLcontext *ctx )
if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT))
update_viewport_matrix(ctx);
if (new_state & _NEW_COLOR)
update_color( ctx );
if (ctx->_MaintainTexEnvProgram) {
if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR | _NEW_FOG))
_mesa_UpdateTexEnvProgram(ctx);