intel: Add support for depth/stencil clears via render pass load op
I want to get the demos to stop issuing explicit image clears entirely
before I change their semantics to require being outside the renderpass.
Color clears were already supported -- this just adds plumbing for
depth/stencil.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
diff --git a/icd/intel/cmd_pipeline.c b/icd/intel/cmd_pipeline.c
index 79d0d2d..19d844d 100644
--- a/icd/intel/cmd_pipeline.c
+++ b/icd/intel/cmd_pipeline.c
@@ -3646,6 +3646,44 @@
ranges);
}
}
+
+ if (rp->depthLoadOp == VK_ATTACHMENT_LOAD_OP_CLEAR) {
+ const struct intel_ds_view *ds = fb->ds;
+
+ VkImageSubresourceRange ranges[1] = {{
+ VK_IMAGE_ASPECT_DEPTH,
+ 0, /* ds->mipLevel, */
+ 1,
+ 0, /* ds->baseArraySlice, */
+ ds->array_size
+ }};
+
+ cmd_meta_clear_depth_stencil_image(cmdBuffer, (VkImage)ds->img,
+ rp->depthStencilLayout,
+ rp->depthLoadClearValue,
+ 0,
+ 1,
+ ranges);
+ }
+
+ if (rp->stencilLoadOp == VK_ATTACHMENT_LOAD_OP_CLEAR) {
+ const struct intel_ds_view *ds = fb->ds;
+
+ VkImageSubresourceRange ranges[1] = {{
+ VK_IMAGE_ASPECT_STENCIL,
+ 0, /* ds->mipLevel, */
+ 1,
+ 0, /* ds->baseArraySlice, */
+ ds->array_size
+ }};
+
+ cmd_meta_clear_depth_stencil_image(cmdBuffer, (VkImage)ds->img,
+ rp->depthStencilLayout,
+ 0.0f,
+ rp->stencilLoadClearValue,
+ 1,
+ ranges);
+ }
}
ICD_EXPORT void VKAPI vkCmdEndRenderPass(