tests: Don't assume there is a memory type index 1

Long-term we need a helper to allocate & bind /appropriate/ memory for
some object. Short-term, just fix this locally.

Allows Anvil (where there is only one memory type!) to survive the
InvalidDynamicOffsetCases test.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 7b9e158..836af8e 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -3214,7 +3214,17 @@
     mem_alloc.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
     mem_alloc.pNext = NULL;
     mem_alloc.allocationSize = 1024;
-    mem_alloc.memoryTypeIndex = 1;
+    mem_alloc.memoryTypeIndex = 0;
+
+    VkMemoryRequirements memReqs;
+    vkGetBufferMemoryRequirements(m_device->device(), dyub, &memReqs);
+    bool pass = m_device->phy().set_memory_type(memReqs.memoryTypeBits, &mem_alloc,
+                                           0);
+    if (!pass) {
+        vkDestroyBuffer(m_device->device(), dyub, NULL);
+        return;
+    }
+
     VkDeviceMemory mem;
     err = vkAllocateMemory(m_device->device(), &mem_alloc, NULL, &mem);
     ASSERT_VK_SUCCESS(err);