pan/bi: Skip ATEST for colour blit shaders

Small win.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9002>
This commit is contained in:
Alyssa Rosenzweig 2021-02-11 21:33:02 -05:00 committed by Marge Bot
parent e279606232
commit accffda30d
1 changed files with 15 additions and 1 deletions

View File

@ -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]);