summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-04-29 15:11:11 -0700
committerEric Anholt <[email protected]>2011-04-29 15:27:02 -0700
commit6a02679f0120f095d2678eec4532e27e9627b26d (patch)
treeff07ef93e239ff48f2f3c2e5a91d14fe22814d7b
parent3032582d032a28381dd4c2f4093d82c79e73129e (diff)
i965/gen6: Fix LogicOp handling for GL_COPY and/or floating-point RTs.
We were accidentally leaving blending enabled for LogicOp GL_COPY, which ARB_color_buffer_float/GL_RGBA32F-render (and friends) caught. Additionally, the GL spec says that no LogicOp should be done to floating-point targets, and the GPU gets really angry even if you say to LogicOp GL_COPY to float.
-rw-r--r--src/mesa/drivers/dri/i965/gen6_cc.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c b/src/mesa/drivers/dri/i965/gen6_cc.c
index 80985db3d68..66357f00fa6 100644
--- a/src/mesa/drivers/dri/i965/gen6_cc.c
+++ b/src/mesa/drivers/dri/i965/gen6_cc.c
@@ -47,10 +47,17 @@ prepare_blend_state(struct brw_context *brw)
for (b = 0; b < nr_draw_buffers; b++) {
/* _NEW_COLOR */
- if (ctx->Color._LogicOpEnabled && ctx->Color.LogicOp != GL_COPY) {
- blend[b].blend1.logic_op_enable = 1;
- blend[b].blend1.logic_op_func =
- intel_translate_logic_op(ctx->Color.LogicOp);
+ if (ctx->Color._LogicOpEnabled) {
+ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[b];
+ /* _NEW_BUFFERS */
+ /* Floating point RTs should have no effect from LogicOp,
+ * except for disabling of blending
+ */
+ if (_mesa_get_format_datatype(rb->Format) != GL_FLOAT) {
+ blend[b].blend1.logic_op_enable = 1;
+ blend[b].blend1.logic_op_func =
+ intel_translate_logic_op(ctx->Color.LogicOp);
+ }
} else if (ctx->Color.BlendEnabled & (1 << b)) {
GLenum eqRGB = ctx->Color.Blend[0].EquationRGB;
GLenum eqA = ctx->Color.Blend[0].EquationA;
@@ -108,7 +115,8 @@ prepare_blend_state(struct brw_context *brw)
const struct brw_tracked_state gen6_blend_state = {
.dirty = {
- .mesa = _NEW_COLOR,
+ .mesa = (_NEW_COLOR |
+ _NEW_BUFFERS),
.brw = BRW_NEW_BATCH,
.cache = 0,
},