diff --git a/tests/unit/external_memory_sync.cpp b/tests/unit/external_memory_sync.cpp index 65b28ce81f8..8e3b7506ea6 100644 --- a/tests/unit/external_memory_sync.cpp +++ b/tests/unit/external_memory_sync.cpp @@ -1347,6 +1347,9 @@ TEST_F(NegativeExternalMemorySync, ImportMemoryHandleType) { m_errorMonitor->SetDesiredError("VUID-vkBindImageMemory-memory-02989"); m_errorMonitor->SetUnexpectedError("VUID-VkBindImageMemoryInfo-pNext-01617"); m_errorMonitor->SetUnexpectedError("VUID-VkBindImageMemoryInfo-pNext-01615"); + if (image_dedicated_allocation) { + m_errorMonitor->SetDesiredError("VUID-vkBindImageMemory-image-01445"); + } vk::BindImageMemory(device(), image_import.handle(), memory_image_import.handle(), 0); m_errorMonitor->VerifyFound(); @@ -1358,6 +1361,9 @@ TEST_F(NegativeExternalMemorySync, ImportMemoryHandleType) { m_errorMonitor->SetDesiredError("VUID-VkBindImageMemoryInfo-memory-02989"); m_errorMonitor->SetUnexpectedError("VUID-VkBindImageMemoryInfo-pNext-01617"); m_errorMonitor->SetUnexpectedError("VUID-VkBindImageMemoryInfo-pNext-01615"); + if (image_dedicated_allocation) { + m_errorMonitor->SetDesiredError("VUID-VkBindImageMemoryInfo-image-01445"); + } vk::BindImageMemory2(device(), 1, &bind_image_info); m_errorMonitor->VerifyFound(); } @@ -2049,7 +2055,21 @@ TEST_F(NegativeExternalMemorySync, ImageDedicatedAllocation) { m_errorMonitor->SetDesiredError("VUID-VkMemoryAllocateInfo-pNext-00639"); // pNext chain contains VkExportMemoryAllocateInfo but not VkMemoryDedicatedAllocateInfo - vkt::Image image(*m_device, image_info, 0, &export_memory_info); + vkt::Image image; + image.InitNoMemory(*m_device, image_info); + { + VkImageMemoryRequirementsInfo2 image_memory_requirements_info = vku::InitStructHelper(); + image_memory_requirements_info.image = image.handle(); + VkMemoryDedicatedRequirements memory_dedicated_requirements = vku::InitStructHelper(); + + VkMemoryRequirements2 memory_requirements = vku::InitStructHelper(&memory_dedicated_requirements); + vk::GetImageMemoryRequirements2(device(), &image_memory_requirements_info, &memory_requirements); + + if (memory_dedicated_requirements.requiresDedicatedAllocation) { + m_errorMonitor->SetDesiredError("VUID-vkBindImageMemory-image-01445"); + } + } + image.AllocateAndBindMemory(*m_device, 0, &export_memory_info); m_errorMonitor->VerifyFound(); } diff --git a/tests/unit/wsi.cpp b/tests/unit/wsi.cpp index 08b99f52af9..46c073386a5 100644 --- a/tests/unit/wsi.cpp +++ b/tests/unit/wsi.cpp @@ -129,18 +129,22 @@ TEST_F(NegativeWsi, BindImageMemorySwapchain) { vkt::Image image_from_swapchain(*m_device, image_create_info, vkt::no_mem); - VkMemoryRequirements mem_reqs = {}; - vk::GetImageMemoryRequirements(device(), image_from_swapchain.handle(), &mem_reqs); + VkImageMemoryRequirementsInfo2 image_memory_requirements_info = vku::InitStructHelper(); + image_memory_requirements_info.image = image_from_swapchain.handle(); + VkMemoryDedicatedRequirements memory_dedicated_requirements = vku::InitStructHelper(); + + VkMemoryRequirements2 mem_reqs = vku::InitStructHelper(&memory_dedicated_requirements); + vk::GetImageMemoryRequirements2(device(), &image_memory_requirements_info, &mem_reqs); VkMemoryAllocateInfo alloc_info = vku::InitStructHelper(); alloc_info.memoryTypeIndex = 0; - alloc_info.allocationSize = mem_reqs.size; + alloc_info.allocationSize = mem_reqs.memoryRequirements.size; if (alloc_info.allocationSize == 0) { GTEST_SKIP() << "Driver seems to not be returning an valid allocation size and need to end test"; } vkt::DeviceMemory mem; - bool pass = m_device->Physical().SetMemoryType(mem_reqs.memoryTypeBits, &alloc_info, 0); + bool pass = m_device->Physical().SetMemoryType(mem_reqs.memoryRequirements.memoryTypeBits, &alloc_info, 0); // some devices don't give us good memory requirements for the swapchain image if (pass) { mem.init(*m_device, alloc_info); @@ -174,6 +178,9 @@ TEST_F(NegativeWsi, BindImageMemorySwapchain) { m_errorMonitor->SetDesiredError("VUID-VkBindImageMemoryInfo-pNext-01631"); } m_errorMonitor->SetDesiredError("VUID-VkBindImageMemorySwapchainInfoKHR-imageIndex-01644"); + if (memory_dedicated_requirements.requiresDedicatedAllocation) { + m_errorMonitor->SetDesiredError("VUID-VkBindImageMemoryInfo-image-01445"); + } vk::BindImageMemory2(device(), 1, &bind_info); m_errorMonitor->VerifyFound();