turnip: disable LRZ depending on fragment changes

Disable LRZ write if the fragment shader discard the fragments, modify
its position or if early-Z is disabled.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
This commit is contained in:
Samuel Iglesias Gonsálvez 2020-06-10 09:35:59 +02:00 committed by Marge Bot
parent d1fa40bdcf
commit fdad1ca256
1 changed files with 11 additions and 0 deletions

View File

@ -2536,6 +2536,17 @@ tu_pipeline_builder_parse_depth_stencil(struct tu_pipeline_builder *builder,
pipeline->lrz.write = false;
pipeline->lrz.invalidate = true;
}
if (builder->shaders[MESA_SHADER_FRAGMENT]) {
const struct ir3_shader_variant *fs = &builder->shaders[MESA_SHADER_FRAGMENT]->ir3_shader->variants[0];
if (fs->has_kill || fs->no_earlyz || fs->writes_pos) {
pipeline->lrz.write = false;
}
if (fs->no_earlyz || fs->writes_pos) {
pipeline->lrz.enable = false;
pipeline->lrz.z_test_enable = false;
}
}
}
static void