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);