April 19, 2017 at 9:50 am #1217
I am trying to upload 3D texture data larger than 1 gig. It looks like the maximum buffer length on OSX is 1024 MB and 256 MB on Ipad. How would this be done in MoltenVk? Upload the data in smaller chunks with vkMapMemory? If this works, can I still have a descriptorSet to one contiguous memory?
Something like this:
VkDeviceSize first = maxSize; // 1024 MB VkDeviceSize second = size - maxSize; checkResult(vkMapMemory(vkContext.device, memory, 0, first, 0, &pData)); memcpy(pData, data, first); vkUnmapMemory(vkContext.device, memory); checkResult(vkMapMemory(vkContext.device, memory, first, second, 0, &pData)); memcpy(pData, data, second); vkUnmapMemory(vkContext.device, memory);
However, when I am trying to do this I am still getting an error:
-[MTLDebugDevice validateNewBufferArgs:options:]:306: failed assertion newBufferWith*:length 0x4cd90400 must not exceed 1024 MB.April 19, 2017 at 5:39 pm #1218
Under Vulkan, device memory is allocated and populated separately from the creation of a buffer or image on that memory.
In order to support this behaviour in the general sense, currently, all device memory allocations under MoltenVK are backed by a
MTLBuffer. Consequently, device memory allocations are limited by the size of a
MTLBufferon the runtime platform.
…BillApril 20, 2017 at 10:03 am #1219
It looks like you can allocate larger textures than buffer memory in Metal. I have been able to create a 512MB 3D texture on an iPad in Metal.
Is this something that can been done in MoltenVK? And if its not, is there something I can write to create a texture with
let texture = device.makeTexture(descriptor: textureDescriptor)And still somehow get a Vulkan-descriptorset from MoltenVK to point to that texture memory?April 21, 2017 at 3:40 pm #1220
Good feedback. I appreciate you letting us know your results with that texture size.
Unfortunately…it’s not currently possible to do either of what you are asking.
VkDeviceMemoryobjects that back Vulkan image objects, are in turn backed by
MTLBuffers. Based on your feedback, we can look at re-factoring how memory management works with textures within MoltenVK, but that will require some development effort, and wouldn’t be available for several weeks.
And unfortunately, the other option…of applying an existing
VkImage…does not exist within the MoltenVK API.
What is your timing on needing this kind of capability?
…BillApril 25, 2017 at 5:15 am #1229
We are going to release the product in the end of the year, so like 2,3 month would not be a problem for us. But the in the final product we are dependent on really large textures and would really appreciate if you would look in to it. The max buffer size on iPad was only 256 MB, its strange that Apple has different limitations for textures and buffers.
krusebornJuly 11, 2017 at 8:04 am #1278
We are making these changes now. Do you have a sample app that includes a large texture…so we can test it to make sure it works in the way you are using it?
…BillJuly 17, 2017 at 1:38 pm #1286
The forum ‘MoltenVK Support’ is closed to new topics and replies.