Module: Mesa Branch: master Commit: accffda30d75ee1cbda95a7a3c577bfcb6415b2e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=accffda30d75ee1cbda95a7a3c577bfcb6415b2e
Author: Alyssa Rosenzweig <[email protected]> Date: Thu Feb 11 21:33:02 2021 -0500 pan/bi: Skip ATEST for colour blit shaders Small win. Signed-off-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9002> --- src/panfrost/bifrost/bifrost_compile.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index e81f7757aa5..4b23cf11421 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -337,6 +337,19 @@ bi_emit_blend_op(bi_builder *b, bi_index rgba, nir_alu_type T, unsigned rt) b->shader->blend_types[rt] = T; } +/* Blend shaders do not need to run ATEST since they are dependent on a + * fragment shader that runs it. Blit shaders may not need to run ATEST, since + * ATEST is not needed if early-z is forced, alpha-to-coverage is disabled, and + * there are no writes to the coverage mask. The latter two are satisfied for + * all blit shaders, so we just care about early-z, which blit shaders force + * iff they do not write depth or stencil */ + +static bool +bi_skip_atest(bi_context *ctx, bool emit_zs) +{ + return (ctx->is_blit && !emit_zs) || ctx->is_blend; +} + static void bi_emit_fragment_out(bi_builder *b, nir_intrinsic_instr *instr) { @@ -370,7 +383,8 @@ bi_emit_fragment_out(bi_builder *b, nir_intrinsic_instr *instr) * value, but render target #0 might not be floating point. However the * alpha value is only used for alpha-to-coverage, a stage which is * skipped for pure integer framebuffers, so the issue is moot. */ - if (!b->shader->emitted_atest && !b->shader->is_blend) { + + if (!b->shader->emitted_atest && !bi_skip_atest(b->shader, emit_zs)) { nir_alu_type T = nir_intrinsic_src_type(instr); bi_index rgba = bi_src_index(&instr->src[0]); _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
