tests:Add FramebufferInUseDestroyedSignaled test
This test creates a binding between framebuffer and cmd buffer, submits
the cmd buffer and then destroys the framebuffer while still in-use to
verify that the correct error is triggered.
Update database file with new test for check 00422.
diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt
index b4b0c8b..356943b 100644
--- a/layers/vk_validation_error_database.txt
+++ b/layers/vk_validation_error_database.txt
@@ -428,7 +428,7 @@
VALIDATION_ERROR_00419~^~U~^~Unknown~^~For more information refer to Vulkan Spec Section '7.3. Framebuffers' which states 'renderPass must be a valid VkRenderPass handle' (https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#renderpass-noattachments)
VALIDATION_ERROR_00420~^~U~^~Unknown~^~For more information refer to Vulkan Spec Section '7.3. Framebuffers' which states 'If attachmentCount is not 0, pAttachments must be a pointer to an array of attachmentCount valid VkImageView handles' (https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#renderpass-noattachments)
VALIDATION_ERROR_00421~^~U~^~Unknown~^~For more information refer to Vulkan Spec Section '7.3. Framebuffers' which states 'Both of renderPass, and the elements of pAttachments that are valid handles must have been created, allocated, or retrieved from the same VkDevice' (https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#renderpass-noattachments)
-VALIDATION_ERROR_00422~^~Y~^~None~^~For more information refer to Vulkan Spec Section '7.3. Framebuffers' which states 'All submitted commands that refer to framebuffer must have completed execution' (https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#vkDestroyFramebuffer)
+VALIDATION_ERROR_00422~^~Y~^~FramebufferInUseDestroyedSignaled~^~For more information refer to Vulkan Spec Section '7.3. Framebuffers' which states 'All submitted commands that refer to framebuffer must have completed execution' (https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#vkDestroyFramebuffer)
VALIDATION_ERROR_00423~^~U~^~Unknown~^~For more information refer to Vulkan Spec Section '7.3. Framebuffers' which states 'If VkAllocationCallbacks were provided when framebuffer was created, a compatible set of callbacks must be provided here' (https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#vkDestroyFramebuffer)
VALIDATION_ERROR_00424~^~U~^~Unknown~^~For more information refer to Vulkan Spec Section '7.3. Framebuffers' which states 'If no VkAllocationCallbacks were provided when framebuffer was created, pAllocator must be NULL' (https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#vkDestroyFramebuffer)
VALIDATION_ERROR_00425~^~Y~^~Unknown~^~For more information refer to Vulkan Spec Section '7.3. Framebuffers' which states 'device must be a valid VkDevice handle' (https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#vkDestroyFramebuffer)
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 035db79..e7a3a17 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -7182,6 +7182,45 @@
vkFreeMemory(m_device->device(), image_memory, nullptr);
}
+TEST_F(VkLayerTest, FramebufferInUseDestroyedSignaled) {
+ TEST_DESCRIPTION("Delete in-use framebuffer.");
+ VkFormatProperties format_properties;
+ VkResult err = VK_SUCCESS;
+ vkGetPhysicalDeviceFormatProperties(gpu(), VK_FORMAT_B8G8R8A8_UNORM, &format_properties);
+
+ ASSERT_NO_FATAL_FAILURE(InitState());
+ ASSERT_NO_FATAL_FAILURE(InitRenderTarget());
+
+ VkImageObj image(m_device);
+ image.init(256, 256, VK_FORMAT_B8G8R8A8_UNORM, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, VK_IMAGE_TILING_OPTIMAL, 0);
+ ASSERT_TRUE(image.initialized());
+ VkImageView view = image.targetView(VK_FORMAT_B8G8R8A8_UNORM);
+
+ VkFramebufferCreateInfo fci = {VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, nullptr, 0, m_renderPass, 1, &view, 256, 256, 1};
+ VkFramebuffer fb;
+ err = vkCreateFramebuffer(m_device->device(), &fci, nullptr, &fb);
+ ASSERT_VK_SUCCESS(err);
+
+ // Just use default renderpass with our framebuffer
+ m_renderPassBeginInfo.framebuffer = fb;
+ // Create Null cmd buffer for submit
+ BeginCommandBuffer();
+ EndCommandBuffer();
+ // Submit cmd buffer to put it in-flight
+ VkSubmitInfo submit_info = {};
+ submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
+ submit_info.commandBufferCount = 1;
+ submit_info.pCommandBuffers = &m_commandBuffer->handle();
+ vkQueueSubmit(m_device->m_queue, 1, &submit_info, VK_NULL_HANDLE);
+ // Destroy framebuffer while in-flight
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Cannot delete framebuffer 0x");
+ vkDestroyFramebuffer(m_device->device(), fb, NULL);
+ m_errorMonitor->VerifyFound();
+ // Wait for queue to complete so we can safely destroy everything
+ vkQueueWaitIdle(m_device->m_queue);
+ vkDestroyFramebuffer(m_device->device(), fb, nullptr);
+}
+
TEST_F(VkLayerTest, FramebufferImageInUseDestroyedSignaled) {
TEST_DESCRIPTION("Delete in-use image that's child of framebuffer.");
VkFormatProperties format_properties;