v3dv_CmdClearAttachments(_cmd_buffer, att_count, atts, 1, &rect);
}
+bool
+v3dv_cmd_buffer_check_needs_load(const struct v3dv_cmd_buffer_state *state,
+ VkImageAspectFlags aspect,
+ uint32_t first_subpass_idx,
+ VkAttachmentLoadOp load_op)
+{
+ /* We call this with image->vk.aspects & aspect, so 0 means the aspect we are
+ * testing does not exist in the image.
+ */
+ if (!aspect)
+ return false;
+
+ /* Attachment (or view) load operations apply on the first subpass that
+ * uses the attachment (or view), otherwise we always need to load.
+ */
+ if (state->job->first_subpass > first_subpass_idx)
+ return true;
+
+ /* If the job is continuing a subpass started in another job, we always
+ * need to load.
+ */
+ if (state->job->is_subpass_continue)
+ return true;
+
+ /* If the area is not aligned to tile boundaries, we always need to load */
+ if (!state->tile_aligned_render_area)
+ return true;
+
+ /* The attachment load operations must be LOAD */
+ return load_op == VK_ATTACHMENT_LOAD_OP_LOAD;
+}
+
+bool
+v3dv_cmd_buffer_check_needs_store(const struct v3dv_cmd_buffer_state *state,
+ VkImageAspectFlags aspect,
+ uint32_t last_subpass_idx,
+ VkAttachmentStoreOp store_op)
+{
+ /* We call this with image->vk.aspects & aspect, so 0 means the aspect we are
+ * testing does not exist in the image.
+ */
+ if (!aspect)
+ return false;
+
+ /* Attachment (or view) store operations only apply on the last subpass
+ * where the attachment (or view) is used, in other subpasses we always
+ * need to store.
+ */
+ if (state->subpass_idx < last_subpass_idx)
+ return true;
+
+ /* Attachment store operations only apply on the last job we emit on the the
+ * last subpass where the attachment is used, otherwise we always need to
+ * store.
+ */
+ if (!state->job->is_subpass_finish)
+ return true;
+
+ /* The attachment store operation must be STORE */
+ return store_op == VK_ATTACHMENT_STORE_OP_STORE;
+}
+
static struct v3dv_job *
cmd_buffer_subpass_create_job(struct v3dv_cmd_buffer *cmd_buffer,
uint32_t subpass_idx,
}
}
-static bool
-check_needs_load(const struct v3dv_cmd_buffer_state *state,
- VkImageAspectFlags aspect,
- uint32_t first_subpass_idx,
- VkAttachmentLoadOp load_op)
-{
- /* We call this with image->vk.aspects & aspect, so 0 means the aspect we are
- * testing does not exist in the image.
- */
- if (!aspect)
- return false;
-
- /* Attachment (or view) load operations apply on the first subpass that
- * uses the attachment (or view), otherwise we always need to load.
- */
- if (state->job->first_subpass > first_subpass_idx)
- return true;
-
- /* If the job is continuing a subpass started in another job, we always
- * need to load.
- */
- if (state->job->is_subpass_continue)
- return true;
-
- /* If the area is not aligned to tile boundaries, we always need to load */
- if (!state->tile_aligned_render_area)
- return true;
-
- /* The attachment load operations must be LOAD */
- return load_op == VK_ATTACHMENT_LOAD_OP_LOAD;
-}
-
static inline uint32_t
v3dv_zs_buffer(bool depth, bool stencil)
{
attachment->first_subpass :
attachment->views[layer].first_subpass;
- bool needs_load = check_needs_load(state,
- VK_IMAGE_ASPECT_COLOR_BIT,
- first_subpass,
- attachment->desc.loadOp);
+ bool needs_load =
+ v3dv_cmd_buffer_check_needs_load(state,
+ VK_IMAGE_ASPECT_COLOR_BIT,
+ first_subpass,
+ attachment->desc.loadOp);
if (needs_load) {
struct v3dv_image_view *iview =
state->attachments[attachment_idx].image_view;
ds_attachment->views[layer].first_subpass;
const bool needs_depth_load =
- check_needs_load(state,
- ds_aspects & VK_IMAGE_ASPECT_DEPTH_BIT,
- ds_first_subpass,
- ds_attachment->desc.loadOp);
+ v3dv_cmd_buffer_check_needs_load(state,
+ ds_aspects & VK_IMAGE_ASPECT_DEPTH_BIT,
+ ds_first_subpass,
+ ds_attachment->desc.loadOp);
const bool needs_stencil_load =
- check_needs_load(state,
- ds_aspects & VK_IMAGE_ASPECT_STENCIL_BIT,
- ds_first_subpass,
- ds_attachment->desc.stencilLoadOp);
+ v3dv_cmd_buffer_check_needs_load(state,
+ ds_aspects & VK_IMAGE_ASPECT_STENCIL_BIT,
+ ds_first_subpass,
+ ds_attachment->desc.stencilLoadOp);
if (needs_depth_load || needs_stencil_load) {
struct v3dv_image_view *iview =
return load_op == VK_ATTACHMENT_LOAD_OP_CLEAR;
}
-static bool
-check_needs_store(const struct v3dv_cmd_buffer_state *state,
- VkImageAspectFlags aspect,
- uint32_t last_subpass_idx,
- VkAttachmentStoreOp store_op)
-{
- /* We call this with image->vk.aspects & aspect, so 0 means the aspect we are
- * testing does not exist in the image.
- */
- if (!aspect)
- return false;
-
- /* Attachment (or view) store operations only apply on the last subpass
- * where the attachment (or view) is used, in other subpasses we always
- * need to store.
- */
- if (state->subpass_idx < last_subpass_idx)
- return true;
-
- /* Attachment store operations only apply on the last job we emit on the the
- * last subpass where the attachment is used, otherwise we always need to
- * store.
- */
- if (!state->job->is_subpass_finish)
- return true;
-
- /* The attachment store operation must be STORE */
- return store_op == VK_ATTACHMENT_STORE_OP_STORE;
-}
-
static void
cmd_buffer_render_pass_emit_stores(struct v3dv_cmd_buffer *cmd_buffer,
struct v3dv_cl *cl,
ds_attachment->views[layer].last_subpass;
bool needs_depth_store =
- check_needs_store(state,
- aspects & VK_IMAGE_ASPECT_DEPTH_BIT,
- ds_last_subpass,
- ds_attachment->desc.storeOp);
+ v3dv_cmd_buffer_check_needs_store(state,
+ aspects & VK_IMAGE_ASPECT_DEPTH_BIT,
+ ds_last_subpass,
+ ds_attachment->desc.storeOp);
bool needs_stencil_store =
- check_needs_store(state,
- aspects & VK_IMAGE_ASPECT_STENCIL_BIT,
- ds_last_subpass,
- ds_attachment->desc.stencilStoreOp);
+ v3dv_cmd_buffer_check_needs_store(state,
+ aspects & VK_IMAGE_ASPECT_STENCIL_BIT,
+ ds_last_subpass,
+ ds_attachment->desc.stencilStoreOp);
/* If we have a resolve, handle it before storing the tile */
const struct v3dv_cmd_buffer_attachment_state *ds_att_state =
attachment->views[layer].last_subpass;
bool needs_store =
- check_needs_store(state,
- VK_IMAGE_ASPECT_COLOR_BIT,
- last_subpass,
- attachment->desc.storeOp);
+ v3dv_cmd_buffer_check_needs_store(state,
+ VK_IMAGE_ASPECT_COLOR_BIT,
+ last_subpass,
+ attachment->desc.storeOp);
/* If we need to resolve this attachment emit that store first. Notice
* that we must not request a tile buffer clear here in that case, since
subpass->do_depth_clear_with_draw);
bool needs_depth_store =
- check_needs_store(state,
- ds_aspects & VK_IMAGE_ASPECT_DEPTH_BIT,
- ds_attachment->last_subpass,
- ds_attachment->desc.storeOp) ||
- subpass->resolve_depth;
+ v3dv_cmd_buffer_check_needs_store(state,
+ ds_aspects & VK_IMAGE_ASPECT_DEPTH_BIT,
+ ds_attachment->last_subpass,
+ ds_attachment->desc.storeOp) ||
+ subpass->resolve_depth;
do_early_zs_clear = needs_depth_clear && !needs_depth_store;
if (do_early_zs_clear &&
vk_format_has_stencil(ds_attachment->desc.format)) {
bool needs_stencil_load =
- check_needs_load(state,
- ds_aspects & VK_IMAGE_ASPECT_STENCIL_BIT,
- ds_attachment->first_subpass,
- ds_attachment->desc.stencilLoadOp);
+ v3dv_cmd_buffer_check_needs_load(state,
+ ds_aspects & VK_IMAGE_ASPECT_STENCIL_BIT,
+ ds_attachment->first_subpass,
+ ds_attachment->desc.stencilLoadOp);
bool needs_stencil_store =
- check_needs_store(state,
- ds_aspects & VK_IMAGE_ASPECT_STENCIL_BIT,
- ds_attachment->last_subpass,
- ds_attachment->desc.stencilStoreOp) ||
- subpass->resolve_stencil;
+ v3dv_cmd_buffer_check_needs_store(state,
+ ds_aspects & VK_IMAGE_ASPECT_STENCIL_BIT,
+ ds_attachment->last_subpass,
+ ds_attachment->desc.stencilStoreOp) ||
+ subpass->resolve_stencil;
do_early_zs_clear = !needs_stencil_load && !needs_stencil_store;
}
vk_format_aspects(ds_attachment->desc.format);
bool needs_depth_load =
- check_needs_load(state,
- ds_aspects & VK_IMAGE_ASPECT_DEPTH_BIT,
- ds_attachment->first_subpass,
- ds_attachment->desc.loadOp);
+ v3dv_cmd_buffer_check_needs_load(state,
+ ds_aspects & VK_IMAGE_ASPECT_DEPTH_BIT,
+ ds_attachment->first_subpass,
+ ds_attachment->desc.loadOp);
if (needs_depth_load) {
struct v3dv_framebuffer *fb = state->framebuffer;