volk icon indicating copy to clipboard operation
volk copied to clipboard

add InstanceTable?

Open CodesOtakuYT opened this issue 1 year ago • 3 comments

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

CodesOtakuYT avatar Aug 17 '23 13:08 CodesOtakuYT

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 avatar Nov 05 '23 20:11 zeux

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.

ilyas-taouaou avatar Nov 06 '23 02:11 ilyas-taouaou

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

zeux avatar Nov 17 '23 15:11 zeux