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
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.sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR; handleInfo.memory = vkMemory; //Got it from Unreal handleInfo.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; 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 (https://github.com/sindharta/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.