如何在多个 VkDevice 之间共享缓冲区(或图像)? [英] How to share buffer (or image) between multiple VkDevice's?

查看:26
本文介绍了如何在多个 VkDevice 之间共享缓冲区(或图像)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有单个 VkInstance 的应用程序.我也有相同的物理设备索引,但不同的 VkPhysicalDevice 对象和不同的 VkDevice 对象.与多个逻辑设备共享 VkBufferVkImage 的最简单和最正确的方法是什么?

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?

推荐答案

我没有这样做,但也许可以尝试使用 VK_KHR_external_memory 扩展.它允许您从 Vulkan 内存对象导出非 Vulkan 句柄,并在缓冲区或图像创建期间提供此类外部内存.

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.

通过这种方式,您可以创建一个可以在逻辑设备之间共享"的内存对象.在一个设备中,您可以以正常方式创建缓冲区/图像和内存对象.然后您导出此内存以获得非 Vulkan 句柄.然后,在您的其余逻辑设备中,您指定要将外部存储器用于缓冲区/图像.

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.

但是要共享内存对象,您必须使用规范指示的相同物理设备:

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

这篇关于如何在多个 VkDevice 之间共享缓冲区(或图像)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆