Skip to content

layers: Validate 01586 for same-format plane views - #13207

Merged
spencer-lunarg merged 1 commit into
KhronosGroup:mainfrom
apollo-2006:vl-01586-plane-view
Sep 26, 2026
Merged

spencer-lunarg merged 1 commit into
KhronosGroup:mainfrom
apollo-2006:vl-01586-plane-view

Conversation

@apollo-2006

@apollo-2006 apollo-2006 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

VUID-VkImageViewCreateInfo-image-01586 requires a single-plane view to use a format compatible with its plane. It was only checked with VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT and a view format different from the image format, so a VK_IMAGE_ASPECT_PLANE_0_BIT view of a G8_B8R8_2PLANE_420_UNORM image that keeps G8_B8R8_2PLANE_420_UNORM as its format was never reported, although plane 0 is R8_UNORM.

01586 is now checked for every single-plane view in one place, next to 07818, and the check in the MUTABLE_FORMAT branch is gone. A plane view of an image without MUTABLE_FORMAT that uses an incompatible format now reports 01586 as well as 12397, since it breaks both.

Test changes: PositiveSampler.SamplerConversionDifferentHandle and NegativeSampler.MultiplaneImageSamplerConversionMismatch created exactly that view (lavapipe asserts on it in lvp_CreateImageView). Their views chain a VkSamplerYcbcrConversionInfo, and as I read 06658 the view format then needs to be the conversion's format, and a PLANE_0 view with that format doesn't match the plane for 01586. So both now create a multi-plane view with VK_IMAGE_ASPECT_COLOR_BIT. The negative test also expects VUID-VkDescriptorImageInfo-sampler-01564: its second write uses a non-immutable sampler, and as I read 01564 that needs a plane aspect on a multi-planar image.

Adds NegativeYcbcr.MultiplanePlaneViewFormat, next to MultiplaneIncompatibleViewFormat2Plane: a PLANE_0 view keeping G8_B8R8_2PLANE_420_UNORM on a MUTABLE_FORMAT image, and a PLANE_0 view with R8G8_UNORM on an image without MUTABLE_FORMAT (which also expects 12397). Neither reports 01586 on main.

Found by running the test suite on lavapipe.

Message for the same-format case:

vkCreateImageView(): pCreateInfo->format (VK_FORMAT_G8_B8R8_2PLANE_420_UNORM) is not compatible with plane 0 of the VkImage 0x70000000007 format VK_FORMAT_G8_B8R8_2PLANE_420_UNORM, must be compatible with VK_FORMAT_R8_UNORM.

Tested: full suite with the mock ICD and max_profile.json, no failures. Image view, sampler and YCbCr tests on lavapipe and RADV (RX 9070 XT).

@apollo-2006
apollo-2006 requested a review from a team as a code owner September 23, 2026 16:28
@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build.

@apollo-2006 apollo-2006 changed the title layers: Validate 01586 for plane views using the multiplane format layers: Validate 01586 for same-format plane views Sep 23, 2026
@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build.

Comment thread tests/unit/sampler.cpp
vkt::Image mpimage(*m_device, image_ci, vkt::set_layout);
ycbcr_info.conversion = conversions_0; // Need two samplers with different conversions
vkt::ImageView view = mpimage.CreateView(VK_IMAGE_ASPECT_PLANE_0_BIT, &ycbcr_info);
vkt::ImageView view = mpimage.CreateView(VK_IMAGE_ASPECT_COLOR_BIT, &ycbcr_info);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is wrong, the VU says

If creating a single-plane view,

if you set VK_IMAGE_ASPECT_COLOR_BIT your view is now not a single plane, but instead all the planes

@apollo-2006 apollo-2006 Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, COLOR_BIT makes it a multi-plane view. My reasoning was that these views chain a VkSamplerYcbcrConversionInfo, so as I read 06658 the view format has to match the conversion's (G8_B8R8_2PLANE_420_UNORM), and with PLANE_0 that format hits 01586. That's why I went with a multi-plane view, but if you had a different fix in mind for these tests I'm happy to change it.

Comment thread layers/core_checks/cc_image.cpp Outdated

// A single-plane view using the image's own multiplane format is never compatible with the plane
// (the mismatched format case is checked below with VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT)
if (image_format == view_format && IsOnlyOneValidPlaneAspect(image_format, aspect_mask)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected this logic to live near the other 01586, having it here is confusing to have the same VUID in 2 different spots

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. There is now a single 01586 check covering every single-plane view, and the one in the MUTABLE_FORMAT branch is gone.

@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build.

Comment thread tests/unit/sampler.cpp
descriptor_write.pImageInfo = &image_infos[0];
m_errorMonitor->SetDesiredError("VUID-VkWriteDescriptorSet-descriptorType-02738");
// The sampler is not immutable, so the COLOR aspect view of a multi-planar image is also invalid
m_errorMonitor->SetDesiredError("VUID-VkDescriptorImageInfo-sampler-01564");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we triggering 01564 suddenly here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it comes from the view now being COLOR_BIT. This second write goes to a binding without immutable samplers, so samplers_0 is used, and as I read 01564 that needs a plane aspect on a multi-planar image. The old PLANE_0 view kept it from firing before. Happy to restructure the test if you'd rather it only hit 02738.


// Creating a single-plane view, the format must be compatible with the plane.
// This includes using the image's own multiplane format, which is never compatible with a plane.
if (IsOnlyOneValidPlaneAspect(image_format, aspect_mask)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are going to move this, can you write a test next to MultiplaneIncompatibleViewFormat2Plane that before this change does not trigger 01586 but now will trigger 01586

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added NegativeYcbcr.MultiplanePlaneViewFormat right after it. It covers a PLANE_0 view that keeps G8_B8R8_2PLANE_420_UNORM on a MUTABLE_FORMAT image, and a PLANE_0 view with R8G8_UNORM on an image without MUTABLE_FORMAT (which also expects 12397). Neither reports 01586 on main.

@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg

Copy link
Copy Markdown
Collaborator

Author apollo-2006 not on autobuild list. Waiting for curator authorization before starting CI build.

@spencer-lunarg
spencer-lunarg merged commit 4315e7f into KhronosGroup:main Sep 26, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants