From 7dee7956f2e295726c23128d1fe47795585c738c Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Fri, 3 Jan 2025 14:17:19 +0100 Subject: [PATCH] tu: Do not re-calculate static blend LRZ state If blend LRZ state was already calculated from static info, re-calculating it with dynamic state would bring stale values and therefor result in a wrong calculations. This resulted in LRZ being disabled when it should have not in native VK titles. CC: mesa-stable Signed-off-by: Danylo Piliaiev Part-of: --- src/freedreno/vulkan/tu_pipeline.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/freedreno/vulkan/tu_pipeline.cc b/src/freedreno/vulkan/tu_pipeline.cc index fa4d3979f79..cd5c103cf83 100644 --- a/src/freedreno/vulkan/tu_pipeline.cc +++ b/src/freedreno/vulkan/tu_pipeline.cc @@ -3785,9 +3785,8 @@ tu_emit_draw_state(struct tu_cmd_buffer *cmd) cmd->vk.dynamic_graphics_state.ms.alpha_to_coverage_enable, cmd->vk.dynamic_graphics_state.ms.alpha_to_one_enable, cmd->vk.dynamic_graphics_state.ms.sample_mask); - if (EMIT_STATE(blend_lrz) || - ((cmd->state.dirty & TU_CMD_DIRTY_SUBPASS) && - !cmd->state.pipeline_blend_lrz)) { + if (!cmd->state.pipeline_blend_lrz && + (EMIT_STATE(blend_lrz) || (cmd->state.dirty & TU_CMD_DIRTY_SUBPASS))) { bool blend_reads_dest = tu6_calc_blend_lrz(&cmd->vk.dynamic_graphics_state.cb, &cmd->state.vk_rp); if (blend_reads_dest != cmd->state.blend_reads_dest) { @@ -3795,9 +3794,8 @@ tu_emit_draw_state(struct tu_cmd_buffer *cmd) cmd->state.dirty |= TU_CMD_DIRTY_LRZ; } } - if (EMIT_STATE(bandwidth) || - ((cmd->state.dirty & TU_CMD_DIRTY_SUBPASS) && - !cmd->state.pipeline_bandwidth)) + if (!cmd->state.pipeline_bandwidth && + (EMIT_STATE(bandwidth) || (cmd->state.dirty & TU_CMD_DIRTY_SUBPASS))) tu_calc_bandwidth(&cmd->state.bandwidth, &cmd->vk.dynamic_graphics_state.cb, &cmd->state.vk_rp); DRAW_STATE(blend_constants, VK_DYNAMIC_STATE_BLEND_CONSTANTS,