How to share buffer (or image) between multiple VkDevice's?

旧巷老猫 提交于 2019-12-11 05:04:39

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!