turnip: Skip rather than invalidate LRZ on gl_FragDepth writes.

As long as the direction is still compatible, if we skip the LRZ use and
updates for this draw, then we can keep using LRZ later in the scene, as
whatever gl_FragDepth will get written by the shader later will still have
to move the depth in the right direction.

Similarly, the no_earlyz flag that contributes to DISABLE_LRZ just wants
to make sure we don't kill fragments before dispatch, not change what Z
eventually lands.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18606>
This commit is contained in:
Emma Anholt 2022-09-13 16:16:30 -07:00 committed by Marge Bot
parent 62d8124522
commit 7b2bdb31f2

View file

@ -702,12 +702,18 @@ tu6_calculate_lrz_state(struct tu_cmd_buffer *cmd,
bool disable_lrz = false;
bool temporary_disable_lrz = false;
/* What happens in FS could affect LRZ, e.g.: writes to gl_FragDepth
* or early fragment tests.
/* What happens in FS could affect LRZ, e.g.: writes to gl_FragDepth or early
* fragment tests. We have to skip LRZ testing and updating, but as long as
* the depth direction stayed the same we can continue with LRZ testing later.
*/
if (pipeline->lrz.force_disable_mask & TU_LRZ_FORCE_DISABLE_LRZ) {
perf_debug(cmd->device, "Invalidating LRZ due to FS");
disable_lrz = true;
if (cmd->state.lrz.prev_direction != TU_LRZ_UNKNOWN || !cmd->state.lrz.gpu_dir_tracking) {
perf_debug(cmd->device, "Skipping LRZ due to FS");
temporary_disable_lrz = true;
} else {
perf_debug(cmd->device, "Disabling LRZ due to FS (TODO: fix for gpu-direction-tracking case");
disable_lrz = true;
}
}
/* If Z is not written - it doesn't affect LRZ buffer state.