diff options
author | Paul Berry <[email protected]> | 2012-06-16 11:32:04 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2012-06-20 11:28:09 -0700 |
commit | cde6544ad7cbc0f4567d294e4d2ac4214199c6ec (patch) | |
tree | 5a1a492d5500c7591699e83639652d9d0422ba36 /src/mesa/drivers/dri/i965/gen7_wm_state.c | |
parent | 3b0279a69392a8fcc81ad462ca5623ec2a73f890 (diff) |
i965/msaa: Only do multisample rasterization if GL_MULTISAMPLE enabled.
From the GL 3.0 spec (p.116):
"Multisample rasterization is enabled or disabled by calling
Enable or Disable with the symbolic constant MULTISAMPLE."
Elsewhere in the spec, where multisample rasterization is described
(sections 3.4.3, 3.5.4, and 3.6.6), the following text is consistently
used:
"If MULTISAMPLE is enabled, and the value of SAMPLE_BUFFERS is
one, then..."
So, in other words, disabling GL_MULTISAMPLE should prevent
multisample rasterization from occurring, even if the draw framebuffer
is multisampled. This patch implements that behaviour by setting the
WM and SF stage's "multisample rasterization mode" to
MSRAST_ON_PATTERN only when the draw framebuffer is multisampled *and*
GL_MULTISAMPLE is enabled.
Fixes piglit test spec/EXT_framebuffer_multisample/enable-flag.
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen7_wm_state.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_wm_state.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c b/src/mesa/drivers/dri/i965/gen7_wm_state.c index f46e3f26ceb..45c8e4605ee 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c @@ -39,12 +39,12 @@ upload_wm_state(struct brw_context *brw) const struct brw_fragment_program *fp = brw_fragment_program_const(brw->fragment_program); bool writes_depth = false; - bool multisampled = false; + bool multisampled_fbo = false; uint32_t dw1, dw2; /* _NEW_BUFFERS */ if (ctx->DrawBuffer->_ColorDrawBuffers[0]) - multisampled = ctx->DrawBuffer->_ColorDrawBuffers[0]->NumSamples > 0; + multisampled_fbo = ctx->DrawBuffer->_ColorDrawBuffers[0]->NumSamples > 0; dw1 = dw2 = 0; dw1 |= GEN7_WM_STATISTICS_ENABLE; @@ -79,8 +79,12 @@ upload_wm_state(struct brw_context *brw) dw1 & GEN7_WM_KILL_ENABLE) { dw1 |= GEN7_WM_DISPATCH_ENABLE; } - if (multisampled) { - dw1 |= GEN7_WM_MSRAST_ON_PATTERN; + if (multisampled_fbo) { + /* _NEW_MULTISAMPLE */ + if (ctx->Multisample.Enabled) + dw1 |= GEN7_WM_MSRAST_ON_PATTERN; + else + dw1 |= GEN7_WM_MSRAST_OFF_PIXEL; dw2 |= GEN7_WM_MSDISPMODE_PERPIXEL; } else { dw1 |= GEN7_WM_MSRAST_OFF_PIXEL; @@ -97,7 +101,8 @@ upload_wm_state(struct brw_context *brw) const struct brw_tracked_state gen7_wm_state = { .dirty = { .mesa = (_NEW_LINE | _NEW_POLYGON | - _NEW_COLOR | _NEW_BUFFERS), + _NEW_COLOR | _NEW_BUFFERS | + _NEW_MULTISAMPLE), .brw = (BRW_NEW_FRAGMENT_PROGRAM | BRW_NEW_BATCH), .cache = CACHE_NEW_WM_PROG, |