问题
I have an application with a single VkInstance
. Also I have the same physical device index, but different VkPhysicalDevice
objects and hence different VkDevice
objects. What would be the easiest and the most correct way to share VkBuffer
or VkImage
with multiple logical devices?
回答1:
I didn't do it, but maybe try using the VK_KHR_external_memory extension. It allows You to export non-Vulkan handles from Vulkan memory objects and provide such external memory during buffer or image creation.
This way You can create a memory object that can be "shared" between logical devices. In one device You create a buffer/image and memory object in a normal way. Then You export this memory to get a non-Vulkan handle. Then, in the rest of Your logical devices, You specify that You want an external memory to be used for a buffer/image.
[EDIT]
But to share a memory object You have to use the same physical device as indicated by the spec:
only the same concrete physical device can be used when sharing memory
来源:https://stackoverflow.com/questions/49920858/how-to-share-buffer-or-image-between-multiple-vkdevices