/* This is needed to support 1.1's RGB logic ops AND
* 1.0's blending logicops.
*/
wherever it tries to figure out if logic ops are actually enabled. Looks like a trap in the OGL specification ;-), maybe other drivers might be affected?
Patch fixes samples/blendeq and samples/blendxor (on my rv250), I hope it doesn't break anything.
Roland
Index: r200_state.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_state.c,v retrieving revision 1.9 diff -u -r1.9 r200_state.c --- r200_state.c 21 Jan 2004 16:08:43 -0000 1.9 +++ r200_state.c 22 Jan 2004 23:35:33 -0000 @@ -137,7 +137,7 @@ R200_STATECHANGE( rmesa, ctx ); rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = b; - if ( ctx->Color.ColorLogicOpEnabled ) { + if ( ctx->Color.ColorLogicOpEnabled || (ctx->Color.BlendEnabled && mode == GL_LOGIC_OP)) { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_ROP_ENABLE; } else { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_ROP_ENABLE; @@ -1669,7 +1669,7 @@ } else { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_ALPHA_BLEND_ENABLE; } - if ( ctx->Color.ColorLogicOpEnabled ) { + if ( ctx->Color.ColorLogicOpEnabled || (state && ctx->Color.BlendEquation == GL_LOGIC_OP)) { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_ROP_ENABLE; } else { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_ROP_ENABLE; @@ -1793,7 +1793,7 @@ case GL_COLOR_LOGIC_OP: R200_STATECHANGE( rmesa, ctx ); - if ( state ) { + if ( state || (ctx->Color.BlendEnabled && ctx->Color.BlendEquation == GL_LOGIC_OP)) { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_ROP_ENABLE; } else { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_ROP_ENABLE;
Index: radeon_state.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/radeon/radeon_state.c,v retrieving revision 1.7 diff -u -r1.7 radeon_state.c --- radeon_state.c 21 Jan 2004 16:08:43 -0000 1.7 +++ radeon_state.c 22 Jan 2004 23:31:16 -0000 @@ -130,7 +130,7 @@ if ( !fallback ) { RADEON_STATECHANGE( rmesa, ctx ); rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = b; - if ( ctx->Color.ColorLogicOpEnabled ) { + if ( ctx->Color.ColorLogicOpEnabled || (ctx->Color.BlendEnabled && mode == GL_LOGIC_OP)) { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ROP_ENABLE; } else { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ROP_ENABLE; @@ -1671,7 +1671,7 @@ } else { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ALPHA_BLEND_ENABLE; } - if ( ctx->Color.ColorLogicOpEnabled ) { + if ( ctx->Color.ColorLogicOpEnabled || (state && ctx->Color.BlendEquation == GL_LOGIC_OP)) { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ROP_ENABLE; } else { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ROP_ENABLE; @@ -1810,7 +1810,7 @@ case GL_COLOR_LOGIC_OP: RADEON_STATECHANGE( rmesa, ctx ); - if ( state ) { + if ( state || (ctx->Color.BlendEnabled && ctx->Color.BlendEquation == GL_LOGIC_OP)) { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ROP_ENABLE; } else { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ROP_ENABLE;