tests: Fix unexpected errors in InvalidMemoryAliasing
Memory bindings are immutable so create a separate image2 to bind
to the second memory allocation instead of re-binding same image.
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 0f558b4..c972a6a 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -1812,6 +1812,7 @@
VkBuffer buffer, buffer2;
VkImage image;
+ VkImage image2;
VkDeviceMemory mem; // buffer will be bound first
VkDeviceMemory mem_img; // image bound first
VkMemoryRequirements buff_mem_reqs, img_mem_reqs;
@@ -1852,6 +1853,8 @@
err = vkCreateImage(m_device->device(), &image_create_info, NULL, &image);
ASSERT_VK_SUCCESS(err);
+ err = vkCreateImage(m_device->device(), &image_create_info, NULL, &image2);
+ ASSERT_VK_SUCCESS(err);
vkGetImageMemoryRequirements(m_device->device(), image, &img_mem_reqs);
@@ -1878,13 +1881,13 @@
err = vkBindImageMemory(m_device->device(), image, mem, 0);
m_errorMonitor->VerifyFound();
- // Now correctly bind image to second mem allocation before incorrectly
+ // Now correctly bind image2 to second mem allocation before incorrectly
// aliasing buffer2
err = vkCreateBuffer(m_device->device(), &buf_info, NULL, &buffer2);
ASSERT_VK_SUCCESS(err);
err = vkAllocateMemory(m_device->device(), &alloc_info, NULL, &mem_img);
ASSERT_VK_SUCCESS(err);
- err = vkBindImageMemory(m_device->device(), image, mem_img, 0);
+ err = vkBindImageMemory(m_device->device(), image2, mem_img, 0);
ASSERT_VK_SUCCESS(err);
m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "is aliased with non-linear image 0x");
err = vkBindBufferMemory(m_device->device(), buffer2, mem_img, 0);
@@ -1893,6 +1896,7 @@
vkDestroyBuffer(m_device->device(), buffer, NULL);
vkDestroyBuffer(m_device->device(), buffer2, NULL);
vkDestroyImage(m_device->device(), image, NULL);
+ vkDestroyImage(m_device->device(), image2, NULL);
vkFreeMemory(m_device->device(), mem, NULL);
vkFreeMemory(m_device->device(), mem_img, NULL);
}