summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_pass.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-06-26 09:08:48 -0700
committerJason Ekstrand <[email protected]>2019-01-14 10:16:52 -0600
commit5e4f9ea363a638645670abeffce08ed58c37c369 (patch)
tree0c1d5cb2f6eeba5b29acb4fb785caad7ad273078 /src/intel/vulkan/anv_pass.c
parent9f4408846885abad1294d1cbbf2f735789b95326 (diff)
anv: Implement VK_KHR_depth_stencil_resolve
Diffstat (limited to 'src/intel/vulkan/anv_pass.c')
-rw-r--r--src/intel/vulkan/anv_pass.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/intel/vulkan/anv_pass.c b/src/intel/vulkan/anv_pass.c
index f0eca41935e..02f2be60e02 100644
--- a/src/intel/vulkan/anv_pass.c
+++ b/src/intel/vulkan/anv_pass.c
@@ -74,6 +74,10 @@ anv_render_pass_compile(struct anv_render_pass *pass)
subpass->depth_stencil_attachment->attachment == VK_ATTACHMENT_UNUSED)
subpass->depth_stencil_attachment = NULL;
+ if (subpass->ds_resolve_attachment &&
+ subpass->ds_resolve_attachment->attachment == VK_ATTACHMENT_UNUSED)
+ subpass->ds_resolve_attachment = NULL;
+
for (uint32_t j = 0; j < subpass->attachment_count; j++) {
struct anv_subpass_attachment *subpass_att = &subpass->attachments[j];
if (subpass_att->attachment == VK_ATTACHMENT_UNUSED)
@@ -116,6 +120,16 @@ anv_render_pass_compile(struct anv_render_pass *pass)
color_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
}
}
+
+ if (subpass->ds_resolve_attachment) {
+ struct anv_subpass_attachment *ds_att =
+ subpass->depth_stencil_attachment;
+ UNUSED struct anv_subpass_attachment *resolve_att =
+ subpass->ds_resolve_attachment;
+
+ assert(resolve_att->usage == VK_IMAGE_USAGE_TRANSFER_DST_BIT);
+ ds_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
+ }
}
/* From the Vulkan 1.0.39 spec:
@@ -342,10 +356,15 @@ VkResult anv_CreateRenderPass(
static unsigned
num_subpass_attachments2(const VkSubpassDescription2KHR *desc)
{
+ const VkSubpassDescriptionDepthStencilResolveKHR *ds_resolve =
+ vk_find_struct_const(desc->pNext,
+ SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR);
+
return desc->inputAttachmentCount +
desc->colorAttachmentCount +
(desc->pResolveAttachments ? desc->colorAttachmentCount : 0) +
- (desc->pDepthStencilAttachment != NULL);
+ (desc->pDepthStencilAttachment != NULL) +
+ (ds_resolve && ds_resolve->pDepthStencilResolveAttachment);
}
VkResult anv_CreateRenderPass2KHR(
@@ -460,6 +479,22 @@ VkResult anv_CreateRenderPass2KHR(
.layout = desc->pDepthStencilAttachment->layout,
};
}
+
+ const VkSubpassDescriptionDepthStencilResolveKHR *ds_resolve =
+ vk_find_struct_const(desc->pNext,
+ SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR);
+
+ if (ds_resolve && ds_resolve->pDepthStencilResolveAttachment) {
+ subpass->ds_resolve_attachment = subpass_attachments++;
+
+ *subpass->ds_resolve_attachment = (struct anv_subpass_attachment) {
+ .usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT,
+ .attachment = ds_resolve->pDepthStencilResolveAttachment->attachment,
+ .layout = ds_resolve->pDepthStencilResolveAttachment->layout,
+ };
+ subpass->depth_resolve_mode = ds_resolve->depthResolveMode;
+ subpass->stencil_resolve_mode = ds_resolve->stencilResolveMode;
+ }
}
for (uint32_t i = 0; i < pCreateInfo->dependencyCount; i++)