freedreno/a6xx: also consider alpha-test for ztest-mode
authorRob Clark <robdclark@chromium.org>
Wed, 3 Jun 2020 22:01:11 +0000 (15:01 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 4 Jun 2020 02:34:54 +0000 (02:34 +0000)
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 <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5298>

src/gallium/drivers/freedreno/a6xx/fd6_emit.c
src/gallium/drivers/freedreno/a6xx/fd6_zsa.c
src/gallium/drivers/freedreno/a6xx/fd6_zsa.h

index 82bf24759a429785bc825baad690bc1990e61ebc..256860bdfcc160f8e3d0ac00181a1563f3041a8a 100644 (file)
@@ -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;
index d7c2000b4247757a64e3121acd92a7c390269bd8..dc7c1fbf087a44aeb5f4868b4b471c3ee4a56946 100644 (file)
@@ -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;
index 73bfa4fba0653ba47b39cf6189d2c29d0ce63032..2d39797116bb5aa080c71c95de465d99369cb582 100644 (file)
@@ -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;