From 813e56db511e783fcf1ad7bcfd40645451802bd7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 18 Jul 2006 19:15:40 +0000 Subject: Compute ctx->Color._LogicOpEnabled in one place instead of four places! --- src/mesa/main/blend.c | 17 ++--------------- src/mesa/main/enable.c | 16 ++-------------- src/mesa/main/state.c | 19 ++++++++++++++++++- 3 files changed, 22 insertions(+), 30 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index aebc70421a..bf886af9e8 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -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 ); } diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 1d439e675f..91268b596d 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -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) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 56b835f537..784757e91f 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -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); -- cgit v1.2.3