Mesa (master): freedreno/a6xx: more early-z

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 5 01:12:33 UTC 2020


Module: Mesa
Branch: master
Commit: f1f81abfd440b7b8ddb51203878a6b97547c19f5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f1f81abfd440b7b8ddb51203878a6b97547c19f5

Author: Rob Clark <robdclark at chromium.org>
Date:   Thu Jun  4 10:07:57 2020 -0700

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 <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5336>

---

 src/gallium/drivers/freedreno/a6xx/fd6_emit.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

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;



More information about the mesa-commit mailing list