From: Rob Clark Date: Wed, 3 Jun 2020 22:01:11 +0000 (-0700) Subject: freedreno/a6xx: also consider alpha-test for ztest-mode X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e9cda38031af98cf504fb9eb90dd4214e494ecb2;p=mesa.git freedreno/a6xx: also consider alpha-test for ztest-mode Looks like we don't have CI coverage for this (since deqp==GLES) but alpha test is conceptually the same as frag shaders with discard, and should be handled as such. Signed-off-by: Rob Clark Part-of: --- diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c index 82bf24759a4..256860bdfcc 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -588,11 +588,12 @@ build_vbo_state(struct fd6_emit *emit, const struct ir3_shader_variant *vp) static enum a6xx_ztest_mode compute_ztest_mode(struct fd6_emit *emit, bool lrz_valid) { + struct fd6_zsa_stateobj *zsa = fd6_zsa_stateobj(emit->ctx->zsa); const struct ir3_shader_variant *fs = emit->fs; if (fs->no_earlyz || fs->writes_pos) { return A6XX_LATE_Z; - } else if (fs->has_kill) { + } else if (fs->has_kill || zsa->alpha_test) { return lrz_valid ? A6XX_EARLY_LRZ_LATE_Z : A6XX_LATE_Z; } else { return A6XX_EARLY_Z; diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_zsa.c b/src/gallium/drivers/freedreno/a6xx/fd6_zsa.c index d7c2000b424..dc7c1fbf087 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_zsa.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_zsa.c @@ -190,6 +190,7 @@ fd6_zsa_state_create(struct pipe_context *pctx, */ if (cso->alpha.func != PIPE_FUNC_ALWAYS) { so->lrz.write = false; + so->alpha_test = true; } uint32_t ref = cso->alpha.ref_value * 255.0; diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_zsa.h b/src/gallium/drivers/freedreno/a6xx/fd6_zsa.h index 73bfa4fba06..2d39797116b 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_zsa.h +++ b/src/gallium/drivers/freedreno/a6xx/fd6_zsa.h @@ -47,6 +47,7 @@ struct fd6_zsa_stateobj { struct fd6_lrz_state lrz; bool invalidate_lrz; + bool alpha_test; struct fd_ringbuffer *stateobj; struct fd_ringbuffer *stateobj_no_alpha;