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

[Best Practices] Validate invalid access/layout combinations for VkImageMemoryBarrier{2KHR} #2918

Closed
Tobski opened this issue Jun 28, 2021 · 2 comments · Fixed by #3970
Closed
Assignees
Labels
BestPractices Best practices layer Incomplete Missing Validation VUs to be added

Comments

@Tobski
Copy link
Contributor

Tobski commented Jun 28, 2021

Describe the situation in which you encountered the missing validation
There are a number of situations in which the set of access flags in the source/destination mask make no sense with an old/new layout in an image memory barrier. While these are not invalid by the spec, it would be helpful to check that the access mask matches up with the specified layout and issue a warning if they don't match.

The following table lists the set of "expected" access flags for a given image layout - anything outside of this should issue a warning.

Layout "Valid" access bits
UNDEFINED Any (can be 0)
GENERAL Any (must not be 0)
COLOR_ATTACHMENT_OPTIMAL COLOR_ATTACHMENT_READ_BIT
COLOR_ATTACHMENT_WRITE_BIT
COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT
DEPTH_STENCIL_ATTACHMENT_OPTIMAL DEPTH_STENCIL_ATTACHMENT_READ_BIT
DEPTH_STENCIL_ATTACHMENT_WRITE_BIT
DEPTH_STENCIL_READ_ONLY_OPTIMAL SHADER_READ_BIT
DEPTH_STENCIL_ATTACHMENT_READ_BIT
SHADER_READ_ONLY_OPTIMAL INPUT_ATTACHMENT_READ_BIT
SHADER_READ_BIT
TRANSFER_SRC_OPTIMAL TRANSFER_READ_BIT
TRANSFER_DST_OPTIMAL TRANSFER_WRITE_BIT
PREINITIALIZED HOST_WRITE_BIT
DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL Depth Aspect:
SHADER_READ_BIT
DEPTH_STENCIL_ATTACHMENT_READ_BIT

Stencil Aspect:
DEPTH_STENCIL_ATTACHMENT_READ_BIT
DEPTH_STENCIL_ATTACHMENT_WRITE_BIT
DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL Depth Aspect:
DEPTH_STENCIL_ATTACHMENT_READ_BIT
DEPTH_STENCIL_ATTACHMENT_WRITE_BIT

Stencil Aspect:
SHADER_READ_BIT
DEPTH_STENCIL_ATTACHMENT_READ_BIT
DEPTH_ATTACHMENT_OPTIMAL DEPTH_STENCIL_ATTACHMENT_READ_BIT
DEPTH_STENCIL_ATTACHMENT_WRITE_BIT
DEPTH_READ_ONLY_OPTIMAL SHADER_READ_BIT
DEPTH_STENCIL_ATTACHMENT_READ_BIT
STENCIL_ATTACHMENT_OPTIMAL DEPTH_STENCIL_ATTACHMENT_READ_BIT
DEPTH_STENCIL_ATTACHMENT_WRITE_BIT
STENCIL_READ_ONLY_OPTIMAL SHADER_READ_BIT
DEPTH_STENCIL_ATTACHMENT_READ_BIT
PRESENT_SRC_KHR Must be 0
SHARED_PRESENT_KHR Any (can be 0)
SHADING_RATE_OPTIMAL_NV SHADING_RATE_IMAGE_READ_BIT_NV
FRAGMENT_DENSITY_MAP_OPTIMAL_EXT FRAGMENT_DENSITY_MAP_READ_BIT_EXT

Valid Usage IDs requested
N/A - These are best practices only, so no VUIDs

@Tobski Tobski added the Incomplete Missing Validation VUs to be added label Jun 28, 2021
@ncesario-lunarg ncesario-lunarg self-assigned this Jun 28, 2021
@ncesario-lunarg ncesario-lunarg added the BestPractices Best practices layer label Jun 28, 2021
@jeremyg-lunarg
Copy link
Contributor

@Tobski, is this table from the Vulkan specification or some other document?

@Tobski
Copy link
Contributor Author

Tobski commented Apr 11, 2022

I manually constructed it based on usage information noted in the descriptions of each image layout. We could add it to the spec but it'd take some serious reworking...

jeremyg-lunarg added a commit to jeremyg-lunarg/Vulkan-ValidationLayers that referenced this issue Nov 2, 2022
It turns out that the table from KhronosGroup#2918 had an implicit "(can be 0)"
on almost every line. The 2 weird cases are:
GENERAL - Any (must not be 0)
PRESENT_SRC_KHR - Must be 0

Fixes KhronosGroup#4735
jeremyg-lunarg added a commit to jeremyg-lunarg/Vulkan-ValidationLayers that referenced this issue Nov 2, 2022
It turns out that the table from KhronosGroup#2918 had an implicit "(can be 0)"
on almost every line. The only weird case is:

PRESENT_SRC_KHR - Must be 0

Fixes KhronosGroup#4735
jeremyg-lunarg added a commit that referenced this issue Nov 3, 2022
It turns out that the table from #2918 had an implicit "(can be 0)"
on almost every line. The only weird case is:

PRESENT_SRC_KHR - Must be 0

Fixes #4735
@juan-lunarg juan-lunarg moved this from To do to Done in Best Practices Project Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BestPractices Best practices layer Incomplete Missing Validation VUs to be added
Projects
Development

Successfully merging a pull request may close this issue.

3 participants