panfrost: Fix discard behaviour on Bifrost
authorIcecream95 <ixn@disroot.org>
Wed, 23 Dec 2020 10:30:24 +0000 (23:30 +1300)
committerMarge Bot <eric+marge@anholt.net>
Mon, 28 Dec 2020 21:25:20 +0000 (21:25 +0000)
Set zs_update_operation to FORCE_LATE, as we don't want to update
depth if the fragment is discarded.

Set pixel_kill_operation to WEAK_EARLY to match the blob.

Reviewed-and-tested-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8235>

src/gallium/drivers/panfrost/pan_assemble.c

index fc645dc..48dcd0f 100644 (file)
@@ -82,6 +82,9 @@ pan_prepare_bifrost_props(struct panfrost_shader_state *state,
                 if (state->writes_depth || state->writes_stencil) {
                         state->properties.bifrost.zs_update_operation = MALI_PIXEL_KILL_FORCE_LATE;
                         state->properties.bifrost.pixel_kill_operation = MALI_PIXEL_KILL_FORCE_LATE;
+                } else if (state->can_discard) {
+                        state->properties.bifrost.zs_update_operation = MALI_PIXEL_KILL_FORCE_LATE;
+                        state->properties.bifrost.pixel_kill_operation = MALI_PIXEL_KILL_WEAK_EARLY;
                 } else {
                         state->properties.bifrost.zs_update_operation = MALI_PIXEL_KILL_STRONG_EARLY;
                         state->properties.bifrost.pixel_kill_operation = MALI_PIXEL_KILL_FORCE_EARLY;