turnip: fix dynamic logicop state
authorChia-I Wu <olvaffe@gmail.com>
Fri, 2 Dec 2022 02:34:23 +0000 (18:34 -0800)
committerMarge Bot <emma+marge@anholt.net>
Tue, 6 Dec 2022 01:13:11 +0000 (01:13 +0000)
When a pipeline has dynamic logicop state or blend state, we defer lrz
write decision to tu6_calculate_lrz_state.  As such,
tu6_calculate_lrz_state should look at both states when either of them
is dynamic.

Fixes dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.21 on
angle, which uses dynamic logicop state and static blend state with
blending enabled.

Fixes: c8c7154c2ec ("tu: Implement extendedDynamicState3ColorBlendEnable")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20136>

src/freedreno/vulkan/tu_lrz.c

index 81830ec..c9580ca 100644 (file)
@@ -675,18 +675,18 @@ tu6_calculate_lrz_state(struct tu_cmd_buffer *cmd,
 
 
    /* See comment in tu_pipeline about disabling LRZ write for blending. */
-   if ((cmd->state.pipeline->dynamic_state_mask & BIT(TU_DYNAMIC_STATE_LOGIC_OP)) &&
-       cmd->state.logic_op_enabled && cmd->state.rop_reads_dst) {
-      if (gras_lrz_cntl.lrz_write)
-         perf_debug(cmd->device, "disabling lrz write due to dynamic logic op");
-      gras_lrz_cntl.lrz_write = false;
-   }
-
-   if ((cmd->state.pipeline->dynamic_state_mask & BIT(TU_DYNAMIC_STATE_BLEND_ENABLE)) &&
-       cmd->state.blend_enable) {
-      if (gras_lrz_cntl.lrz_write)
-         perf_debug(cmd->device, "disabling lrz write due to dynamic blend");
-      gras_lrz_cntl.lrz_write = false;
+   if (gras_lrz_cntl.lrz_write && cmd->state.pipeline->dynamic_state_mask &
+         (BIT(TU_DYNAMIC_STATE_LOGIC_OP) |
+          BIT(TU_DYNAMIC_STATE_BLEND_ENABLE))) {
+       if (cmd->state.logic_op_enabled && cmd->state.rop_reads_dst) {
+          perf_debug(cmd->device, "disabling lrz write due to dynamic logic op");
+          gras_lrz_cntl.lrz_write = false;
+       }
+
+       if (cmd->state.blend_enable) {
+          perf_debug(cmd->device, "disabling lrz write due to dynamic blend");
+          gras_lrz_cntl.lrz_write = false;
+       }
    }
 
    if ((cmd->state.pipeline->dynamic_state_mask & BIT(TU_DYNAMIC_STATE_BLEND))) {