Skip to content
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 InstanceTable? #137

Open
CodesOtakuYT opened this issue Aug 17, 2023 · 3 comments · May be fixed by #154
Open

add InstanceTable? #137

CodesOtakuYT opened this issue Aug 17, 2023 · 3 comments · May be fixed by #154
Labels
enhancement New feature or request

Comments

@CodesOtakuYT
Copy link

is it possible to add an instance table instead of loading the functions in global scope?

@zeux
Copy link
Owner

zeux commented Nov 5, 2023

vkGetInstanceProcAddr, vkCreateInstance, vkEnumerateInstanceExtensionProperties, vkEnumerateInstanceLayerProperties, vkEnumerateInstanceVersion would need to still be loaded as globals (volk calls them "loader functions").

volk could provide VolkInstanceTable struct & volkLoadInstanceTable function for other instance functions I think. Out of curiosity, why do you need this - are you working with multiple Vulkan instances?

@zeux zeux added the enhancement New feature or request label Nov 5, 2023
@ilyas-taouaou
Copy link

ilyas-taouaou commented Nov 6, 2023

vkGetInstanceProcAddr, vkCreateInstance, vkEnumerateInstanceExtensionProperties, vkEnumerateInstanceLayerProperties, vkEnumerateInstanceVersion would need to still be loaded as globals (volk calls them "loader functions").

volk could provide VolkInstanceTable struct & volkLoadInstanceTable function for other instance functions I think. Out of curiosity, why do you need this - are you working with multiple Vulkan instances?

It would be useful for library developers, where an instance class can be instantiated multiple times by the user for whatever reason.
Generally it's better to avoid global state or singletons, after all the vulkan spec allows for multiple instances and the returned function could be different although currently in practice they're the same.
Yea, the vulkan global vulkan functions you mentioned are fine.

@zeux zeux linked a pull request Nov 6, 2023 that will close this issue
@zeux
Copy link
Owner

zeux commented Nov 17, 2023

@ilyas-taouaou let me know if the API in #154 will work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants