From 2cc14bd7b8919231b12a250c54edb8203fc6fcc0 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Tue, 26 Nov 2019 17:53:09 +0200 Subject: [PATCH] anv: set stencil layout for input attachments If an input attachment has a stencil format, we need to set this. v2: Fish out VkAttachmentReferenceStencilLayoutKHR from VkAttachmentReference2KHR::pNext (Jason) Signed-off-by: Lionel Landwerlin Reported-by: Samuel Pitoiset Fixes: c1c346f16673 ("anv: implement VK_KHR_separate_depth_stencil_layouts") Reviewed-by: Jason Ekstrand Tested-by: Marge Bot Part-of: --- src/intel/vulkan/anv_pass.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/intel/vulkan/anv_pass.c b/src/intel/vulkan/anv_pass.c index 067d9d55d67..a43af07317f 100644 --- a/src/intel/vulkan/anv_pass.c +++ b/src/intel/vulkan/anv_pass.c @@ -291,9 +291,10 @@ VkResult anv_CreateRenderPass( for (uint32_t j = 0; j < desc->inputAttachmentCount; j++) { subpass->input_attachments[j] = (struct anv_subpass_attachment) { - .usage = VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT, - .attachment = desc->pInputAttachments[j].attachment, - .layout = desc->pInputAttachments[j].layout, + .usage = VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT, + .attachment = desc->pInputAttachments[j].attachment, + .layout = desc->pInputAttachments[j].layout, + .stencil_layout = desc->pInputAttachments[j].layout, }; } } @@ -471,10 +472,17 @@ VkResult anv_CreateRenderPass2KHR( subpass_attachments += desc->inputAttachmentCount; for (uint32_t j = 0; j < desc->inputAttachmentCount; j++) { + const VkAttachmentReferenceStencilLayoutKHR *stencil_layout = + vk_find_struct_const(desc->pInputAttachments[j].pNext, + ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR); + subpass->input_attachments[j] = (struct anv_subpass_attachment) { - .usage = VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT, - .attachment = desc->pInputAttachments[j].attachment, - .layout = desc->pInputAttachments[j].layout, + .usage = VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT, + .attachment = desc->pInputAttachments[j].attachment, + .layout = desc->pInputAttachments[j].layout, + .stencil_layout = (stencil_layout ? + stencil_layout->stencilLayout : + desc->pInputAttachments[j].layout), }; } } -- 2.30.2