layers: Clean up no memory bound checks
When memory is freed make sure to clear bindings in associated objects.
Also clean up reporting of no memory bound errors. Old assumption was that
no memory had every been bound, but it's also possible to hit such errors
if the bound memory was freed prior to operation of interest.
In descriptor error cases where no memory is bound, add a final error string
as clarification since descriptor errors are built up of multiple strings
with details from each function call in the tree.
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 0ea2e69..0445573 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -6993,9 +6993,9 @@
err = vkAllocateMemory(m_device->device(), &mem_alloc, NULL, &image_mem);
ASSERT_VK_SUCCESS(err);
- // Introduce error, do not call vkBindImageMemory(m_device->device(), image,
- // image_mem, 0);
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "used without first calling vkBindImageMemory");
+ // Introduce error, do not call vkBindImageMemory(m_device->device(), image, image_mem, 0);
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ " used with no memory bound. Memory should be bound by calling vkBindImageMemory() and ");
m_commandBuffer->BeginCommandBuffer();
VkClearColorValue ccv;
@@ -7052,9 +7052,9 @@
err = vkAllocateMemory(m_device->device(), &alloc_info, NULL, &mem);
ASSERT_VK_SUCCESS(err);
- // Introduce failure by not calling vkBindBufferMemory(m_device->device(),
- // buffer, mem, 0);
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "used without first calling vkBindBufferMemory");
+ // Introduce failure by not calling vkBindBufferMemory(m_device->device(), buffer, mem, 0);
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ " used with no memory bound. Memory should be bound by calling vkBindImageMemory() and ");
VkBufferImageCopy region = {};
region.bufferRowLength = 128;
region.bufferImageHeight = 128;
@@ -7824,7 +7824,8 @@
" no memory bound to it.");
VkResult err;
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "used without first calling vkBindBufferMemory");
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ " used with no memory bound. Memory should be bound by calling vkBindImageMemory() and ");
ASSERT_NO_FATAL_FAILURE(InitState());
@@ -8029,7 +8030,10 @@
TEST_DESCRIPTION("Attempt to update a descriptor with a non-sparse buffer "
"that doesn't have memory bound");
VkResult err;
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, " used without first calling vkBindBufferMemory.");
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ " used with no memory bound. Memory should be bound by calling vkBindImageMemory() and ");
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "vkUpdateDescriptorsSets() failed write update validation for Descriptor Set 0x");
ASSERT_NO_FATAL_FAILURE(InitState());
ASSERT_NO_FATAL_FAILURE(InitViewport());
@@ -15826,8 +15830,8 @@
TEST_F(VkLayerTest, CreateImageViewNoMemoryBoundToImage) {
VkResult err;
-
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "used without first calling vkBindImageMemory");
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ " used with no memory bound. Memory should be bound by calling vkBindImageMemory() and ");
ASSERT_NO_FATAL_FAILURE(InitState());