From: Rob Clark Date: Thu, 4 Jun 2020 17:07:57 +0000 (-0700) Subject: freedreno/a6xx: more early-z X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f1f81abfd440b7b8ddb51203878a6b97547c19f5;p=mesa.git freedreno/a6xx: more early-z Technically we only have to do late-z in the alpha-test or discard case if depth-write is enabled. If depth write is disabled, the depth read / test / conditional-write interlock that we need to emulate is not a problem, so we can still use early-z test. There is a slightly weird case when there is no zsbuf attachment (see dEQP-GLES31.functional.fbo.no_attachments.*) where the hw wants us to use LATE_Z.. not entirely sure if this is an interaction with occlusion query or just a pecularity of how the hw works when there is no depth buffer. 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 a805872638f..0853a9529b0 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -584,12 +584,21 @@ build_vbo_state(struct fd6_emit *emit) 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); + struct fd_context *ctx = emit->ctx; + struct pipe_framebuffer_state *pfb = &ctx->batch->framebuffer; + struct fd6_zsa_stateobj *zsa = fd6_zsa_stateobj(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 || zsa->alpha_test) { + } else if ((fs->has_kill || zsa->alpha_test) && + (zsa->base.depth.writemask || !pfb->zsbuf)) { + /* Slightly odd, but seems like the hw wants us to select + * LATE_Z mode if there is no depth buffer + discard. Either + * that, or when occlusion query is enabled. See: + * + * dEQP-GLES31.functional.fbo.no_attachments.* + */ return lrz_valid ? A6XX_EARLY_LRZ_LATE_Z : A6XX_LATE_Z; } else { return A6XX_EARLY_Z;