-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid usage of VmaAllocation #116
Comments
While we are at it, it would be best to access the mapped data from |
Thanks, switched to using allocation.pMappedData. This didn't fix my issues but at least it compiles now lol. |
This was a build error for me. void* data;
vmaMapMemory(_allocator, staging.allocation, &data);
memcpy(data, vertices.data(), vertexBufferSize);
memcpy((char*)data + vertexBufferSize, indices.data(), indexBufferSize);
vmaUnmapMemory(_allocator, staging.allocation); removed the error GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator#30 (comment)
The tutorial text itself should be updated also: Once we have the buffer, we can take its mapped address with GetMappedData(), this gives us a void* pointer
we can write to. So we do 2 memcpy commands to copy both spans into it. to Once we have the buffer, we can use vmaMapMemory to give us a void* pointer we can write to. So we do 2
memcpy commands to copy both spans into it. vmaUnmapMemory is used here because we have to remember to
unmap the memory after we are done copying the data. |
Oh I see the VMA_ALLOCATION_CREATE_MAPPED_BIT is best with |
Starting in chapter 3, Mesh Buffers, the guide introduces users to VMA. Buffers are created for vertices and indices, as well as host-visible staging buffers.
The guide instructs users to use
staging.allocation->GetMappedData()
to acquire a pointer to write to the staging buffer. However, this is not valid usage.VmaAllocation
is an opaque type in VMA, and all of its members and functions are only visible to the single translation unit that definesVMA_IMPLEMENTATION
. This works in vkguide's case because all of the code is withinvk_engine.cpp
, but it's probably not something we want to be teaching new users in a tutorial scenario.All of the mentions of
GetMappedData()
should probably be replaced with the public API functionvmaMapMemory()
.The text was updated successfully, but these errors were encountered: