KhronosGroup / KhronosGroup/Vulkan-Docs
Allow DRM format modifier to be set during `vkBindImageMemory`
@linyaa-kiwi is already working on this.
Since Aug 21, 2024.
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 549
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 2
Description
Context
I was working on wine, trying to (partially) implement VK_EXT_external_memory_win32 on top of native Vulkan. The basic idea is to encapsulate dma-buf file descriptors as win32 handles, and vice versa when crossing the win32/unix boundary in wine.
Problem is, to bind a VkImage to dma-buf memory, the image must be created with a VkImageDrmFormatModifierExplicitCreateInfoEXT. Which means I must know what the modifier is at image creation time.
Obviously win32 doesn't have the concept of drm format modifiers. So I must smuggle the information over somehow. And the only reasonable place to hide this information is when I encapsulate dma-buf descriptors into win32 handles. But these handles are not part of the information used to create VkImages. Which is to say, there is no way to make the drm format modifier information available at image creation time.
Proposal
Since the win32 handles carry the format modifier, and VkDeviceMemory is created out of these handles, vkBindImageMemory is going to be the point where the modifier and the VkImage first come into contact.
Add a structure extending VkBindImageMemoryInfo to allow specifying the drm format modifier at bind time.
Alternative?
Seems to me this is the only way to do it. Unless there is some other way to smuggle the modifier information across the win32/unix boundary.
Related to
VK_EXT_image_drm_format_modifier and VK_EXT_external_memory_dma_buf @versalinyaa
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.