-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add VK_EXT_external_memory_metal #2414
base: main
Are you sure you want to change the base?
Add VK_EXT_external_memory_metal #2414
Conversation
a1ac4fa
to
9d16d7e
Compare
@aitor-lunarg process-wise, we require that extension number and flag bits be reserved by a commit to main prior to the extension development branch actually being able to use them. I don't know where this extension stands deployment / release-wise, but we need to separate out the reservations and accept those first, to avoid a race condition (see extension 597 for a guide to what that PR would look like). |
Before moving forward with this extension, there's one concern that we need to address. Metal does not provide all Vulkan formats, so there are times where an implementation will emulate some of them. Why is this an issue: Implementations may decide to emulate those formats with an internal representation such that those formats are backed by multiple textures. Taking MoltenVK as an example implementation with There are 3 potential solutions that come to mind to fix this issue as we stand:
@linyaa-kiwi would it be possible to bring this up for discussion this coming SI meeting? I would like to understand if other similar extensions have run into similar issues and how they've tackled them if so. Or just get general feedback/ideas about this issue. cc/ @kocdemir |
@aitor-lunarg Would you like to discuss in today's SI meeting? If not, what week works best for you? |
the device memory object. | ||
|
||
The lifespan of the returned handle object is the same as the associated `VkDeviceMemory` object. | ||
The app must: retain the handle object if it intends to use it beyond that lifespan. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that the lifetime language is incorrect, unless I misunderstand the meaning of "retain". The text says that the lifespan of the Metal handle is the same as the VkDeviceMemory; therefore, destruction of the VkDeviceMemory also invalidates the Metal handle. However, the text's sentence suggests that the lifetime can be extended by "retaining" the handle; this sentence contradicts the first sentence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metal objects are reference counted and only destroyed when the count reaches 0. This part of the spec is trying to state that unless the user calls retain
(which increases the count) on the returned Metal object, the lifespan will be that of the VkDeviceMemory
. That is why beyond that lifespan
is used.
I will try to think of a better way to word this part since I see it can lead to confusion. If you have any suggestion on how to word it, do let me know!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if it's clearer now!
| ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_MTLBUFFER_BIT_EXT | Must match | Must match | ||
| ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_MTLTEXTURE_BIT_EXT | Must match | Must match | ||
| ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_MTLHEAP_BIT_EXT | Must match | Must match | ||
endif::VK_EXT_external_memory_metal[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about the choice of "Must match" in this table. I suspect that the constraint is impossible to satisfy in the extension's intended use cases.
When sharing a Metal handle with a different VkDevice in a different VkInstance, the "must match" constraint is easy to satisfy. That's not my concern.
I assume that an intended use case for the extension is to share Metal handles outside of Vulkan. (Please correct me if I'm wrong). In that case, do the relevant sharing apis expose the equivalent of driverUUID
, and does that UUID match the Vulkan driver's driverUUID
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that an intended use case for the extension is to share Metal handles outside of Vulkan.
For the Android Emulator, sharing outside of the Vulkan is not a priority, as we won't be sharing the handle with OpenGL on Mac, and we share the buffers and images only between different Vulkan instances and devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe changing driverUUID
here to No restriction
should be the way forward since Metal does not have an equivalent. The only requirement should be that the deviceUUID
matches, and Metal does provide an equivalent.
No description provided.