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 <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16654>
(cherry picked from commit 55466ca506)
This commit is contained in:
Timur Kristóf 2022-05-25 11:35:37 +02:00 committed by Dylan Baker
parent d62bc76174
commit b75c1b047f
2 changed files with 16 additions and 1 deletions

View file

@ -283,7 +283,7 @@
"description": "radv: Disable predication for supass clear and image clears.",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -1897,6 +1897,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);
@ -1945,6 +1949,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;
}
@ -2212,6 +2217,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);
@ -2228,6 +2237,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
@ -2240,6 +2250,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);
@ -2247,6 +2261,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