i965/msaa: Set KILL_ENABLE when GL_ALPHA_TO_COVERAGE enabled.
authorPaul Berry <stereotype441@gmail.com>
Mon, 25 Jun 2012 23:57:10 +0000 (16:57 -0700)
committerPaul Berry <stereotype441@gmail.com>
Tue, 26 Jun 2012 14:45:54 +0000 (07:45 -0700)
i965 hardware needs to be informed of situations in which it's
possible for pixels (or samples) to be discarded for reasons other
than depth/stencil testing (e.g. due to an explicit "discard" in the
fragment shader).  One of these situations is when
GL_ALPHA_TO_COVERAGE is enabled, since that can cause samples to be
discarded by the color calculator when the pixel's alpha value is less
than 1.0.

Without this patch, GL_ALPHA_TO_COVERAGE does not take effect on depth
buffers.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/mesa/drivers/dri/i965/gen6_wm_state.c
src/mesa/drivers/dri/i965/gen7_wm_state.c

index 662435e64f7e3f73841c8c182285ea5dceaf0d4f..fa83eced7a3ca865ab2fa7151e9ea7563239b316 100644 (file)
@@ -186,8 +186,9 @@ upload_wm_state(struct brw_context *brw)
    dw6 |= brw->wm.prog_data->barycentric_interp_modes <<
       GEN6_WM_BARYCENTRIC_INTERPOLATION_MODE_SHIFT;
 
-   /* _NEW_COLOR */
-   if (fp->program.UsesKill || ctx->Color.AlphaEnabled)
+   /* _NEW_COLOR, _NEW_MULTISAMPLE */
+   if (fp->program.UsesKill || ctx->Color.AlphaEnabled ||
+       ctx->Multisample.SampleAlphaToCoverage)
       dw5 |= GEN6_WM_KILL_ENABLE;
 
    if (brw_color_buffer_write_enabled(brw) ||
index 45c8e4605eeaef0740ac0bf07534b4e512db0611..8e4417eb3f63816204861076ea9386f0185a15af 100644 (file)
@@ -70,8 +70,9 @@ upload_wm_state(struct brw_context *brw)
    dw1 |= brw->wm.prog_data->barycentric_interp_modes <<
       GEN7_WM_BARYCENTRIC_INTERPOLATION_MODE_SHIFT;
 
-   /* _NEW_COLOR */
-   if (fp->program.UsesKill || ctx->Color.AlphaEnabled)
+   /* _NEW_COLOR, _NEW_MULTISAMPLE */
+   if (fp->program.UsesKill || ctx->Color.AlphaEnabled ||
+       ctx->Multisample.SampleAlphaToCoverage)
       dw1 |= GEN7_WM_KILL_ENABLE;
 
    /* _NEW_BUFFERS */