tests:Update DSBufferInfoErrors
authorTobin Ehlis <tobine@google.com>
Fri, 3 Nov 2017 21:01:20 +0000 (15:01 -0600)
committerTobin Ehlis <tobine@google.com>
Mon, 6 Nov 2017 23:29:51 +0000 (16:29 -0700)
Allocate buffer memory based on requirements returned from device.

tests/layer_validation_tests.cpp

index cbc155e..3551e8b 100644 (file)
@@ -11800,14 +11800,13 @@ TEST_F(VkLayerTest, DSBufferInfoErrors) {
     ASSERT_VK_SUCCESS(err);
 
     // Have to bind memory to buffer before descriptor update
+    VkMemoryRequirements mem_reqs;
+    vkGetBufferMemoryRequirements(m_device->device(), buffer, &mem_reqs);
     VkMemoryAllocateInfo mem_alloc = {};
     mem_alloc.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
     mem_alloc.pNext = NULL;
-    mem_alloc.allocationSize = buff_ci.size;
+    mem_alloc.allocationSize = mem_reqs.size;
     mem_alloc.memoryTypeIndex = 0;
-
-    VkMemoryRequirements mem_reqs;
-    vkGetBufferMemoryRequirements(m_device->device(), buffer, &mem_reqs);
     bool pass = m_device->phy().set_memory_type(mem_reqs.memoryTypeBits, &mem_alloc, 0);
     if (!pass) {
         vkDestroyBuffer(m_device->device(), buffer, NULL);