summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIcecream95 <ixn@keemail.me>2020-05-12 14:08:09 +1200
committerMarge Bot <eric+marge@anholt.net>2020-05-14 01:08:21 +0000
commit0dd24b381c52e0b20fe70041e95611aad6b0d258 (patch)
tree0bbbe3f93c9e07fb141e22b85df21c4235caaa54
parent15dd7933bc33bb13d146f9e0a1f79092e749f33b (diff)
panfrost: Fix background showing when using discard
This fixes problems in a number of games, including SuperTuxKart, OpenMW and RVGL. v2: Use MALI_READS_ZS | 0x20 instead of MALI_WRITES_Z to match with the blob. Keep using 0x400 | 0x20 when depth is disabled. Closes: #2620 Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5001>
-rw-r--r--src/gallium/drivers/panfrost/pan_cmdstream.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 34c2c7a2af0..50eaa195a69 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -789,8 +789,14 @@ panfrost_frag_shader_meta_init(struct panfrost_context *ctx,
* related to forward-pixel kill, as per "Mali Performance 3: Is
* EGL_BUFFER_PRESERVED a good thing?" by Peter Harris */
+ const struct pipe_depth_stencil_alpha_state *zsa = ctx->depth_stencil;
+
+ bool depth_enabled = fs->writes_depth ||
+ (zsa && zsa->depth.enabled && zsa->depth.func != PIPE_FUNC_ALWAYS);
+
SET_BIT(fragmeta->unknown2_3, MALI_CAN_DISCARD, fs->can_discard);
- SET_BIT(fragmeta->midgard1.flags_lo, 0x400, fs->can_discard);
+ SET_BIT(fragmeta->midgard1.flags_lo, 0x400, !depth_enabled && fs->can_discard);
+ SET_BIT(fragmeta->midgard1.flags_lo, MALI_READS_ZS, depth_enabled && fs->can_discard);
}
panfrost_frag_meta_rasterizer_update(ctx, fragmeta);