Accessing Vulkan memory for interop (Unreal Engine)

Hi, everybody,

I have a special problem and I’m not finding a solution. I want to access the memory of a Vulkan image from the Unreal Engine.
At the moment I can access PFN_vkGetMemoryFdKHR or PFN_vkGetMemoryWin32HandleKHR using VkInstance. But when I try to access this method with the VkDevice my application crashes.
Do I use the wrong VkDevice? - Unreal seems to offer several. Is there a method which checks if I use the correct one?
Is it possible to find out all devices of an instance? I didn’t find anything in the docs.

Is it possible that a certain extension is disabled? - Which exactly do I need for accessing the memory? Or how can I activate it?

Here is some code:

PFN_vkGetMemoryWin32HandleKHR func = (PFN_vkGetMemoryWin32HandleKHR)VulkanRHI::vkGetDeviceProcAddr(TextureDevice /* Got it from Unreal*/, "vkGetMemoryWin32HandleKHR");

						handleInfo.memory = vkMemory; //Got it from Unreal
int handle = -1;
func(TextureDevice, &handleInfo, &handle); // Error

I have only little experience with Vulkan, but I would like to solve this problem with the help of the Vulkan Sandbox (
In this project (without the Unreal Engine) the memory of the GPU is also accessed.
I would be grateful for any help. If you have any questions, feel free to ask them. I try to answer them.


Are you using Validation Layers in Vulkan?

Yes, by comparing the UUID or LUID from VkPhysicalDeviceIDProperties.

You mean in Vulkan? Well, um, simply vkEnumeratePhysicalDevices.

Only the extensions that you explicitly enabled are enabled.

VK_KHR_external_memory_capabilities and VK_KHR_get_physical_device_properties2 on instance. On device VK_KHR_external_memory, VK_KHR_external_memory_win32 (or another OS equivalent), also VK_KHR_dedicated_allocation+ VK_KHR_get_memory_requirements2 comes in handy.

For convenience all of that except VK_KHR_external_memory_win32 is also a core part of Vulkan 1.1.

Plus possibly external sync extensions too if\when you use thi

vkCreateInstance and vkCreateDevice.

How did you “got” a VkDeviceMemory from unreal??
Anyway, vkGetMemoryWin32HandleKHR is an export of Vulkan memory to outside. It converts a VkDeviceMemory to a Windows HANDLE. That really what you intended to do by that code snippet?