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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user