tests:Update InvalidDynamicOffsetCases
authorTobin Ehlis <tobine@google.com>
Fri, 3 Nov 2017 20:30:52 +0000 (14:30 -0600)
committerTobin Ehlis <tobine@google.com>
Mon, 6 Nov 2017 23:29:51 +0000 (16:29 -0700)
Allocate buffer memory based on size requirements.

tests/layer_validation_tests.cpp

index 06189b2..83a202e 100644 (file)
@@ -7868,16 +7868,14 @@ TEST_F(VkLayerTest, InvalidDynamicOffsetCases) {
     VkBuffer dyub;
     err = vkCreateBuffer(m_device->device(), &buffCI, NULL, &dyub);
     ASSERT_VK_SUCCESS(err);
-    // Allocate memory and bind to buffer so we can make it to the appropriate
-    // error
+    // Allocate memory and bind to buffer so we can make it to the appropriate error
+    VkMemoryRequirements memReqs;
+    vkGetBufferMemoryRequirements(m_device->device(), dyub, &memReqs);
     VkMemoryAllocateInfo mem_alloc = {};
     mem_alloc.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
     mem_alloc.pNext = NULL;
-    mem_alloc.allocationSize = 1024;
+    mem_alloc.allocationSize = memReqs.size;
     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);