Mesa (master): r600: Logic Operations Fix
Alex Deucher
agd5f at kemper.freedesktop.org
Sun Aug 2 22:04:44 UTC 2009
Module: Mesa
Branch: master
Commit: 562ca4961186954d3abf216bcfb1e835b562b234
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=562ca4961186954d3abf216bcfb1e835b562b234
Author: vehemens <vehemens at verizon.net>
Date: Sun Aug 2 18:03:58 2009 -0400
r600: Logic Operations Fix
fixes bug 23087
---
src/mesa/drivers/dri/r600/r700_state.c | 42 ++++++++++++++++++++++++++++----
1 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c
index e0a5742..b75f531 100644
--- a/src/mesa/drivers/dri/r600/r700_state.c
+++ b/src/mesa/drivers/dri/r600/r700_state.c
@@ -600,14 +600,46 @@ static void r700BlendFuncSeparate(GLcontext * ctx,
/**
* Translate LogicOp enums into hardware representation.
- * Both use a very logical bit-wise layout, but unfortunately the order
- * of bits is reversed.
*/
static GLuint translate_logicop(GLenum logicop)
{
- GLuint bits = logicop - GL_CLEAR;
- bits = ((bits & 1) << 3) | ((bits & 2) << 1) | ((bits & 4) >> 1) | ((bits & 8) >> 3);
- return bits;
+ switch (logicop) {
+ case GL_CLEAR:
+ return 0x00;
+ case GL_SET:
+ return 0xff;
+ case GL_COPY:
+ return 0xcc;
+ case GL_COPY_INVERTED:
+ return 0x33;
+ case GL_NOOP:
+ return 0xaa;
+ case GL_INVERT:
+ return 0x55;
+ case GL_AND:
+ return 0x88;
+ case GL_NAND:
+ return 0x77;
+ case GL_OR:
+ return 0xee;
+ case GL_NOR:
+ return 0x11;
+ case GL_XOR:
+ return 0x66;
+ case GL_EQUIV:
+ return 0xaa;
+ case GL_AND_REVERSE:
+ return 0x44;
+ case GL_AND_INVERTED:
+ return 0x22;
+ case GL_OR_REVERSE:
+ return 0xdd;
+ case GL_OR_INVERTED:
+ return 0xbb;
+ default:
+ fprintf(stderr, "unknown blend logic operation %x\n", logicop);
+ return 0xcc;
+ }
}
/**
More information about the mesa-commit
mailing list