tu: Don't disable EARLY_Z if SampleMask is written without d/s write
With EARLY_Z depth is written before FS is executed, so if FS writes gl_SampleMask - the d/s written before FS would be incorrect since sample mask can kill samples. However, if there is no d/s write it's ok to kill fragment before FS. Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34900>
This commit is contained in:
committed by
Marge Bot
parent
5926b63f66
commit
824194aa0b
@@ -6209,6 +6209,10 @@ tu6_build_depth_plane_z_mode(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
|
||||
(cmd->state.pipeline_feedback_loops & VK_IMAGE_ASPECT_DEPTH_BIT) ||
|
||||
(cmd->vk.dynamic_graphics_state.feedback_loops &
|
||||
VK_IMAGE_ASPECT_DEPTH_BIT) ||
|
||||
/* EARLY_Z causes D/S to be written before FS but gl_SampleMask can
|
||||
* kill fragments, we cannot have EARLY_Z + gl_SampleMask + D/S writes.
|
||||
*/
|
||||
fs->variant->writes_smask ||
|
||||
tu_fs_reads_dynamic_ds_input_attachment(cmd, fs)) &&
|
||||
(depth_write || stencil_write)) {
|
||||
zmode = (cmd->state.lrz.valid && cmd->state.lrz.enabled)
|
||||
|
||||
@@ -2747,7 +2747,7 @@ tu_shader_create(struct tu_device *dev,
|
||||
if (key->fragment_density_map)
|
||||
shader->fs.lrz.status = TU_LRZ_FORCE_DISABLE_LRZ;
|
||||
if (!fs->fs.early_fragment_tests &&
|
||||
(fs->no_earlyz || fs->writes_stencilref || fs->writes_smask)) {
|
||||
(fs->no_earlyz || fs->writes_stencilref)) {
|
||||
shader->fs.lrz.force_late_z = true;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user