I'm managing a VkInstance
that was created (and remains owned by) some other library. I need to know what instance extension names were provided to the VkInstanceCreateInfo
that was used to create the VkInstance
. Because I didn't create the VkInstance
, I don't have direct access to the VkInstanceCreateInfo::ppEnabledExtensionNames
field.
Given a particular VkInstance
handle, how can I figure out what extension names were provided to the vkCreateInstance
call that created it?
Note that this question is not about what instance extensions are available on the current Vulkan implementation; I want to know what a particular VkInstance
was created with.
CodePudding user response:
Broadly speaking, if Vulkan is given data from the application to do something, Vulkan doesn't provide a way for the application to ask for some of that data back. It is assumed that if the application gave Vulkan data, and that data is important to the application, the application ought to store it themselves.
In your case, "the application" is divided into two parts. One part creates some Vulkan object. The other part wants to interact with that object, but has no means of interacting with the first part outside of receiving the Vulkan object. From Vulkan's perspective, this is a problem with "the application", not with Vulkan.
So no, it provides no mechanism to help you.
This is why, when GLFW added Vulkan support, they didn't make GLFW create the Vulkan instance. Instead, it tells you what extensions and features that GLFW needs you to request when creating your instance.
So that's the correct way to handle this: everyone who has an interest in interacting with the Vulkan instance also needs to have a say in its creation. If this other library assigns you to manage the instance without telling you anything about how it created it, then that's a communication problem between that library and your code.