Input attachment descriptors incorrectly allowing VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL layout
Environment:
- OS: Ubuntu 24.04
- GPU and driver version: Intel/Mesa 26.0.0-devel
- SDK or header version if building from repo: 39c50d7bf094853a1f9a2e8a7e3377d425ae0c6a
- Options enabled (synchronization, best practices, etc.): none
Describe the Issue
Running one of the new tests for VK_EXT_custom_resolve, the test is dEQP-VK.dynamic_rendering.partial_secondary_cmd_buff.custom_resolve.fast_lib.depth_format_change_d16_to_d24 using a descriptor like this :
vkUpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies) returns void:
device: VkDevice = 0x5620b6e41730
descriptorWriteCount: uint32_t = 1
pDescriptorWrites: const VkWriteDescriptorSet* = 0x5620b6ece7c0
pDescriptorWrites[0]: const VkWriteDescriptorSet = 0x5620b6ece7c0:
sType: VkStructureType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET (35)
pNext: const void* = NULL
dstSet: VkDescriptorSet = 0x5620b6e7f2e8
dstBinding: uint32_t = 0
dstArrayElement: uint32_t = 0
descriptorCount: uint32_t = 1
descriptorType: VkDescriptorType = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT (10)
pImageInfo: const VkDescriptorImageInfo* = 0x5620b6e40860
pImageInfo[0]: const VkDescriptorImageInfo = 0x5620b6e40860:
sampler: VkSampler = 0
imageView: VkImageView = 0x5620b6e3f4d0
imageLayout: VkImageLayout = VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL (1000314001)
pBufferInfo: const VkDescriptorBufferInfo* = UNUSED
pTexelBufferView: const VkBufferView* = UNUSED
descriptorCopyCount: uint32_t = 0
pDescriptorCopies: const VkCopyDescriptorSet* = NULL
According to https://docs.vulkan.org/spec/latest/chapters/descriptorsets.html#descriptorsets-inputattachment
VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL is not a valid layout for VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT. Not sure why the validation layers include it https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/main/layers/core_checks/cc_descriptor.cpp#L1365
Expected behavior
I would expect a warning on VUID-VkWriteDescriptorSet-descriptorType-04151 when running this test
Valid Usage ID N/A
Additional context
N/A
@llandwerlin-intel where is the ANV Mesa branch to test this (can't hit the test with RADV)
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38510
@artem-lunarg can you take a look at this, something is really off, the list of formats for VU 04149/04150/04151 seems wrong and missing things
Here is a test to reproduce the issue above
TEST_F(NegativeDescriptors, DepthInputMultiSampled) {
TEST_DESCRIPTION("https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/11098");
AddRequiredExtensions(VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME);
AddRequiredFeature(vkt::Feature::synchronization2);
RETURN_IF_SKIP(Init());
const VkFormat depth_format = FindSupportedDepthOnlyFormat(Gpu());
auto image_ci = vkt::Image::ImageCreateInfo2D(8, 8, 1, 1, depth_format, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT);
vkt::Image depth_image(*m_device, image_ci, vkt::set_layout);
vkt::ImageView image_view = depth_image.CreateView(VK_IMAGE_ASPECT_DEPTH_BIT);
VkDescriptorImageInfo image_info = {VK_NULL_HANDLE, image_view, VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL};
OneOffDescriptorSet descriptor_set(m_device,
{{0, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}});
VkWriteDescriptorSet descriptor_write = vku::InitStructHelper();
descriptor_write.dstSet = descriptor_set.set_;
descriptor_write.descriptorCount = 1;
descriptor_write.dstArrayElement = 0;
descriptor_write.dstBinding = 0;
descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
descriptor_write.pImageInfo = &image_info;
m_errorMonitor->SetDesiredError("VUID-VkWriteDescriptorSet-descriptorType-04151");
vk::UpdateDescriptorSets(device(), 1, &descriptor_write, 0, nullptr);
m_errorMonitor->VerifyFound();
}
It looks like that validation code is old and out of date, needs some refresh.