diff options
author | Jason Ekstrand <[email protected]> | 2018-06-26 09:22:20 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-07-09 10:11:53 -0700 |
commit | 208be8eafa30be6c5e79fe3235f5404fd803baf1 (patch) | |
tree | 6a2e335488b896df7b3a52c36f5111c29e14ce1c /src/intel/vulkan/anv_pass.c | |
parent | 75e308fc44a02e80e6c83b7bbe5266b01cea1fce (diff) |
anv: Make subpass::depth_stencil_attachment a pointer
This makes certain checks a bit easier and means that we don't have
the attachment information duplicated in the attachment list and in
depth_stencil_attachment.
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_pass.c')
-rw-r--r-- | src/intel/vulkan/anv_pass.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/intel/vulkan/anv_pass.c b/src/intel/vulkan/anv_pass.c index cb5e4bb7b79..cb73359af79 100644 --- a/src/intel/vulkan/anv_pass.c +++ b/src/intel/vulkan/anv_pass.c @@ -66,6 +66,14 @@ anv_render_pass_compile(struct anv_render_pass *pass) for (uint32_t i = 0; i < pass->subpass_count; i++) { struct anv_subpass *subpass = &pass->subpasses[i]; + /* We don't allow depth_stencil_attachment to be non-NULL and be + * VK_ATTACHMENT_UNUSED. This way something can just check for NULL + * and be guaranteed that they have a valid attachment. + */ + if (subpass->depth_stencil_attachment && + subpass->depth_stencil_attachment->attachment == VK_ATTACHMENT_UNUSED) + subpass->depth_stencil_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) @@ -86,7 +94,8 @@ anv_render_pass_compile(struct anv_render_pass *pass) } if (subpass_att->usage == VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT && - subpass_att->attachment == subpass->depth_stencil_attachment.attachment) + subpass->depth_stencil_attachment && + subpass_att->attachment == subpass->depth_stencil_attachment->attachment) subpass->has_ds_self_dep = true; } @@ -283,18 +292,13 @@ VkResult anv_CreateRenderPass( } if (desc->pDepthStencilAttachment) { - subpass->depth_stencil_attachment = (struct anv_subpass_attachment) { + subpass->depth_stencil_attachment = subpass_attachments++; + + *subpass->depth_stencil_attachment = (struct anv_subpass_attachment) { .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, .attachment = desc->pDepthStencilAttachment->attachment, .layout = desc->pDepthStencilAttachment->layout, }; - *subpass_attachments++ = subpass->depth_stencil_attachment; - } else { - subpass->depth_stencil_attachment = (struct anv_subpass_attachment) { - .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, - .attachment = VK_ATTACHMENT_UNUSED, - .layout = VK_IMAGE_LAYOUT_UNDEFINED, - }; } } @@ -357,8 +361,7 @@ void anv_GetRenderAreaGranularity( * for all sample counts. */ for (unsigned i = 0; i < pass->subpass_count; ++i) { - if (pass->subpasses[i].depth_stencil_attachment.attachment != - VK_ATTACHMENT_UNUSED) { + if (pass->subpasses[i].depth_stencil_attachment) { *pGranularity = (VkExtent2D) { .width = 8, .height = 4 }; return; } |