tu: Clear viewport dirty state with static viewports
authorConnor Abbott <cwabbott0@gmail.com>
Mon, 10 Oct 2022 20:05:00 +0000 (22:05 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 3 Nov 2022 21:59:42 +0000 (21:59 +0000)
Vulkan allows the user to set extraneous dynamic state which then gets
ignored if a pipeline with static state is bound. We weren't
implementing this correctly for viewports because we weren't clearing
the dirty bit, but it was happening to work until changes for dynamic
depth negative-one-to-one broke
dEQP-VK.pipeline.*.depth.depth_clip_control.d32_sfloat_less_viewport_before_static.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18912>

src/freedreno/vulkan/tu_cmd_buffer.c

index db18d28..a15055c 100644 (file)
@@ -2613,6 +2613,9 @@ tu_CmdBindPipeline(VkCommandBuffer commandBuffer,
       cmd->state.dirty |= TU_CMD_DIRTY_VIEWPORTS;
    }
 
+   if (!(pipeline->dynamic_state_mask & BIT(VK_DYNAMIC_STATE_VIEWPORT)))
+      cmd->state.dirty &= ~TU_CMD_DIRTY_VIEWPORTS;
+
    if (!(pipeline->dynamic_state_mask & BIT(TU_DYNAMIC_STATE_VERTEX_INPUT)))
       tu_update_num_vbs(cmd, pipeline->vi.num_vbs);