Module: Mesa Branch: main Commit: 55466ca506f6ea6c4f242f764f4d52588869d423 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=55466ca506f6ea6c4f242f764f4d52588869d423
Author: Timur Kristóf <[email protected]> Date: Wed May 25 11:35:37 2022 +0200 radv: Disable predication for supass clear and image clears. According to the Vulkan spec 21.4 "Conditional Rendering", only clearing attachments with vkCmdClearAttachments is subject to conditional rendering. Subpass clear and vkCmdClearColorImage / vkCmdClearDepthStencilImage should always be executed even if it happens in a conditional rendering block. Cc: mesa-stable Signed-off-by: Timur Kristóf <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16654> --- src/amd/vulkan/radv_meta_clear.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c index 3c374945d43..1aa23c2c46c 100644 --- a/src/amd/vulkan/radv_meta_clear.c +++ b/src/amd/vulkan/radv_meta_clear.c @@ -1999,6 +1999,10 @@ radv_cmd_buffer_clear_subpass(struct radv_cmd_buffer *cmd_buffer) if (!radv_subpass_needs_clear(cmd_buffer)) return; + /* Subpass clear should not be affected by conditional rendering. */ + bool old_predicating = cmd_buffer->state.predicating; + cmd_buffer->state.predicating = false; + radv_meta_save(&saved_state, cmd_buffer, RADV_META_SAVE_GRAPHICS_PIPELINE | RADV_META_SAVE_CONSTANTS); @@ -2047,6 +2051,7 @@ radv_cmd_buffer_clear_subpass(struct radv_cmd_buffer *cmd_buffer) } radv_meta_restore(&saved_state, cmd_buffer); + cmd_buffer->state.predicating = old_predicating; cmd_buffer->state.flush_bits |= post_flush; } @@ -2314,6 +2319,10 @@ radv_CmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image_h, VkImageL struct radv_meta_saved_state saved_state; bool cs; + /* Clear commands (except vkCmdClearAttachments) should not be affected by conditional rendering. */ + bool old_predicating = cmd_buffer->state.predicating; + cmd_buffer->state.predicating = false; + cs = cmd_buffer->qf == RADV_QUEUE_COMPUTE || !radv_image_is_renderable(cmd_buffer->device, image); @@ -2330,6 +2339,7 @@ radv_CmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image_h, VkImageL pRanges, cs); radv_meta_restore(&saved_state, cmd_buffer); + cmd_buffer->state.predicating = old_predicating; } VKAPI_ATTR void VKAPI_CALL @@ -2342,6 +2352,10 @@ radv_CmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image_h, RADV_FROM_HANDLE(radv_image, image, image_h); struct radv_meta_saved_state saved_state; + /* Clear commands (except vkCmdClearAttachments) should not be affected by conditional rendering. */ + bool old_predicating = cmd_buffer->state.predicating; + cmd_buffer->state.predicating = false; + radv_meta_save(&saved_state, cmd_buffer, RADV_META_SAVE_GRAPHICS_PIPELINE | RADV_META_SAVE_CONSTANTS); @@ -2349,6 +2363,7 @@ radv_CmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image_h, rangeCount, pRanges, false); radv_meta_restore(&saved_state, cmd_buffer); + cmd_buffer->state.predicating = old_predicating; } VKAPI_ATTR void VKAPI_CALL
