Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on layout transitions for unused attachments. #821

Closed
jzulauf-lunarg opened this issue Oct 8, 2018 · 2 comments
Closed

Clarification on layout transitions for unused attachments. #821

jzulauf-lunarg opened this issue Oct 8, 2018 · 2 comments
Assignees

Comments

@jzulauf-lunarg
Copy link

From Validation Layers Git Hub Issue 300 --KhronosGroup/Vulkan-ValidationLayers#300 and KhronosGroup/Vulkan-ValidationLayers#303

Vulkan spec section 7.1 states:

If an attachment is not used by any subpass, then loadOp, storeOp, stencilStoreOp, and stencilLoadOp are ignored, and the attachment’s memory contents will not be modified by execution of a render pass instance.

Does the statement "memory contents will not be modified" imply also that the final layout of an unreferenced attachment should be ignored too. However validation tracks the new layout even for unused attachments, currently.

The bug is requesting that these layouts be treated as ignored, but it's unclear whether that is the intention of the spec language above

@janharaldfredriksen-arm

@janharaldfredriksen-arm
Copy link

I don't think the initial & final layout should be ignored, i.e. that the validation layers are doing the right thing here.

--
The motivation for having the language about load and store ops being ignored in this case is that without it, at least tilers would have to insert an implicit subpass just in order to perform that operation.

The spec uses different wording to describe when load/store ops happen vs the layout transitions.

Load/Store ops for an attachment happen as part of the subpass that references those attachments:

loadOp is a VkAttachmentLoadOp value specifying how the contents of color and depth components of the attachment are treated at the beginning of the subpass where it is first used.

(similar language exists for storeOp)

Layout transitions happen at the begin/end of a render pass instance:

initialLayout is the layout the attachment image subresource will be in when a render pass instance begins.

And:

finalLayout is the layout the attachment image subresource will be transitioned to when a render pass instance ends. During a render pass instance, an attachment can use a different layout in each subpass, if desired.

This is saying that the layout transitions happen regardless of whether the attachments are used within the render pass instance.

@jzulauf-lunarg
Copy link
Author

Thanks for the clarification.

alegal-arm pushed a commit to KhronosGroup/VK-GL-CTS that referenced this issue Jan 17, 2019
Before the renderpass the "unused" attachment image is cleared
to a known value and left in the VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL
layout. However, the initialLayout field for the "unused"
attachment is set to VK_IMAGE_LAYOUT_UNDEFINED, which might
cause the image contents to be perturbed when the image
is transitioned from VK_IMAGE_LAYOUT_UNDEFINED to the
finalLayout of VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL.

I understand that part of the purpose of these
"unused_attachment" tests is to ensure "unused" attachments
aren't modified by the renderpass. However, there is nothing
in the Vulkan spec that says the layout of "unused"
attachments should be ignored. This was discussed in issue:
KhronosGroup/Vulkan-Docs#821

And the conclusion is that the layout must: not be ignored
for "unused" attacments.

Affects:
dEQP-VK.renderpass*.unused_attachment.*

Components: Vulkan

VK-GL-CTS issue: 1129

Change-Id: Ia6db607538cb191bc8ca6e03f8da9c88bac031c4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants