From 329ae922bdbfd94ddc7c958d4902107f2eb78cab Mon Sep 17 00:00:00 2001 From: Anuj Phogat Date: Thu, 20 Oct 2016 11:40:40 -0700 Subject: [PATCH] i965: Fix alpha-to-coverage and alpha test enabled checks Signed-off-by: Anuj Phogat Reviewed-by: Ben Widawsky --- src/mesa/drivers/dri/i965/brw_wm.c | 4 ++-- src/mesa/drivers/dri/i965/gen6_wm_state.c | 7 ++++--- src/mesa/drivers/dri/i965/gen7_wm_state.c | 7 ++++--- src/mesa/drivers/dri/i965/gen8_depth_state.c | 10 ++++++---- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index f433ed6f4da..f434af9772c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -528,7 +528,8 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key) /* _NEW_MULTISAMPLE, _NEW_COLOR, _NEW_BUFFERS */ key->replicate_alpha = ctx->DrawBuffer->_NumColorDrawBuffers > 1 && - (ctx->Multisample.SampleAlphaToCoverage || ctx->Color.AlphaEnabled); + (_mesa_is_alpha_test_enabled(ctx) || + _mesa_is_alpha_to_coverage_enabled(ctx)); /* _NEW_BUFFERS _NEW_MULTISAMPLE */ /* Ignore sample qualifier while computing this flag. */ @@ -547,7 +548,6 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key) key->input_slots_valid = brw->vue_map_geom_out.slots_valid; } - /* _NEW_COLOR | _NEW_BUFFERS */ /* Pre-gen6, the hardware alpha test always used each render * target's alpha to do alpha test, as opposed to render target 0's alpha diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c index a618ea95ca7..a67e626f723 100644 --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c @@ -251,9 +251,10 @@ upload_wm_state(struct brw_context *brw) (ctx->Color.BlendEnabled & 1) && ctx->Color.Blend[0]._UsesDualSrc; - /* _NEW_COLOR, _NEW_MULTISAMPLE */ - const bool kill_enable = prog_data->uses_kill || ctx->Color.AlphaEnabled || - ctx->Multisample.SampleAlphaToCoverage || + /* _NEW_COLOR, _NEW_MULTISAMPLE _NEW_BUFFERS */ + const bool kill_enable = prog_data->uses_kill || + _mesa_is_alpha_test_enabled(ctx) || + _mesa_is_alpha_to_coverage_enabled(ctx) || prog_data->uses_omask; /* Rendering against the gl-context is always taken into account. */ diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c b/src/mesa/drivers/dri/i965/gen7_wm_state.c index 110c02c3df2..be026e0589a 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c @@ -69,11 +69,12 @@ upload_wm_state(struct brw_context *brw) dw1 |= prog_data->barycentric_interp_modes << GEN7_WM_BARYCENTRIC_INTERPOLATION_MODE_SHIFT; - /* _NEW_COLOR, _NEW_MULTISAMPLE */ + /* _NEW_COLOR, _NEW_MULTISAMPLE _NEW_BUFFERS */ /* Enable if the pixel shader kernel generates and outputs oMask. */ - if (prog_data->uses_kill || ctx->Color.AlphaEnabled || - ctx->Multisample.SampleAlphaToCoverage || + if (prog_data->uses_kill || + _mesa_is_alpha_test_enabled(ctx) || + _mesa_is_alpha_to_coverage_enabled(ctx) || prog_data->uses_omask) { dw1 |= GEN7_WM_KILL_ENABLE; } diff --git a/src/mesa/drivers/dri/i965/gen8_depth_state.c b/src/mesa/drivers/dri/i965/gen8_depth_state.c index 73b218679b5..0543bf1bc79 100644 --- a/src/mesa/drivers/dri/i965/gen8_depth_state.c +++ b/src/mesa/drivers/dri/i965/gen8_depth_state.c @@ -293,10 +293,12 @@ pma_fix_enable(const struct brw_context *brw) const bool ps_computes_depth = wm_prog_data->computed_depth_mode != BRW_PSCDEPTH_OFF; - /* BRW_NEW_FS_PROG_DATA: 3DSTATE_PS_EXTRA::PixelShaderKillsPixels - * BRW_NEW_FS_PROG_DATA: 3DSTATE_PS_EXTRA::oMask Present to RenderTarget + /* BRW_NEW_FS_PROG_DATA: 3DSTATE_PS_EXTRA::PixelShaderKillsPixels + * BRW_NEW_FS_PROG_DATA: 3DSTATE_PS_EXTRA::oMask Present to RenderTarget * _NEW_MULTISAMPLE: 3DSTATE_PS_BLEND::AlphaToCoverageEnable * _NEW_COLOR: 3DSTATE_PS_BLEND::AlphaTestEnable + * _NEW_BUFFERS: 3DSTATE_PS_BLEND::AlphaTestEnable + * 3DSTATE_PS_BLEND::AlphaToCoverageEnable * * 3DSTATE_WM_CHROMAKEY::ChromaKeyKillEnable is always false. * 3DSTATE_WM::ForceKillPix != ForceOff is always true. @@ -304,8 +306,8 @@ pma_fix_enable(const struct brw_context *brw) const bool kill_pixel = wm_prog_data->uses_kill || wm_prog_data->uses_omask || - (_mesa_is_multisample_enabled(ctx) && ctx->Multisample.SampleAlphaToCoverage) || - ctx->Color.AlphaEnabled; + _mesa_is_alpha_test_enabled(ctx) || + _mesa_is_alpha_to_coverage_enabled(ctx); /* The big formula in CACHE_MODE_1::NP PMA FIX ENABLE. */ return !wm_force_thread_dispatch && -- 2.30.2