I might be wrong but what I understand from the VMA docs is that the purpose of the VMA_ALLOCATION_CREATE_MAPPED_BIT is to have the memory persistently mapped on the host. From my understanding we could thus get rid of vmaMapMemory/vmaMapMemory and use the pointer to the mapped area stored in the VmaAllocationInfo instead. We could thus replace :
chk(vmaMapMemory(allocator, vBufferAllocation, &bufferPtr));
memcpy(bufferPtr, vertices.data(), vBufSize);
memcpy(((char*)bufferPtr) + vBufSize, indices.data(), iBufSize);
vmaUnmapMemory(allocator, vBufferAllocation);
by
VmaAllocationInfo bufferAllocI;
chk(vmaCreateBuffer(allocator, &bufferCI, &bufferAllocCI, &vBuffer,
&vBufferAllocation, &bufferAllocI));
memcpy(bufferAllocI.pMappedData, vertices.data(), vBufSize);
memcpy((reinterpret_cast<uint8_t *>(bufferAllocI.pMappedData)) + vBufSize, indices.data(), iBufSize);
This change worked on by build but maybe I am missing something. :)
I might be wrong but what I understand from the VMA docs is that the purpose of the
VMA_ALLOCATION_CREATE_MAPPED_BITis to have the memory persistently mapped on the host. From my understanding we could thus get rid ofvmaMapMemory/vmaMapMemoryand use the pointer to the mapped area stored in theVmaAllocationInfoinstead. We could thus replace :by
This change worked on by build but maybe I am missing something. :)