cancel
Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

Kotory
Journeyman III

About sharing readonly VkImage across VkInstances

Hi, 

 

I am trying to share readonly VkImages across VkInstances, but could not make it right on AMD cards.

I posted a question on stackoverflow but no luck there.

 

graphics - How to share readonly VkDeviceMemory for VkImages across VkInstances? - Stack Overflow

 

I wonder if anyone could help me with the question, any help will be appreciated.

 

Thanks!

0 Likes
2 Replies
dipak
Big Boss

Hi @Kotory ,

Thank you for posting it. I have whitelisted you and moved the post to the Vulkan forum.

I have forwarded the query to the Vulkan team. I will let you know if they have any suggestion on this.

Thanks.

Hi Kotory,

Can you provide compilable source code to reproduce the issue?

From the images provided, there looks to be an offset issue.

Generally you can export allocated memory via vkAllocateMemory with extension VkExportMemoryAllocateInfo, specifying the export type as VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT

See: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkExportMemoryAllocateInfoKHR.html

Then multiple instances can query for the file descriptor via vkGetMemoryFdKHR 

See: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetMemoryFdKHR.html

Using that File Descriptor the instances can then import the memory allocated previously by calling vkAllocateMemory with extension VkImportMemoryFdInfoKHR, which accepts the File Descriptor as a parameter

See: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkImportMemoryFdInfoKHR.html

You will have to add additional logic which looks at every VKImage creation called in your instances (A,B) to query your server (S) to synchronize allocation offsets, but via this extension it should be doable to bind multiple VKImages to the same memory location.

Thanks,

Owen

 

0 Likes