charles-lunarg / vk-bootstrap

Vulkan Bootstrapping Iibrary
MIT License
820 stars 82 forks source link

Possibility to get enabled extensions from PhysicalDevice #199

Closed martty closed 1 year ago

martty commented 1 year ago

Sometimes one wants some extensions if they are there, but no biggie if they aren't. If the extension comes with a function pointer, then one can check if the extension was loaded by seeing the FP is null or not (although I am not sure if this is guaranteed). But the PhysicalDevice already knows which extensions are there that were desired, so it should allow me to know it directly instead.

charles-lunarg commented 1 year ago

By extensions I assume you mean device extensions.

Its possible to get the list of available device extensions for each physical device, which should be what you want. Whether or not those extensions are enabled is up to device creation, aka only the device can know which extensions were enabled.

The get_extensions() function already exists for PhysicalDevice, is that not what you need?

martty commented 1 year ago

D'oh, I was on an old version, apologies. Yes, the get_extensions() is what I am looking for, although a possible improvement to this API would be to support something like:

vkb::PhysicalDevice::is_extension_enabled(VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME)

charles-lunarg commented 1 year ago

A query API would be nice, but naming wise I don't like "is_enable" cause that implies it is already enabled.

That makes more sense on the Device, which is needed to use vkGetDeviceProcAddr anyhow, so I'm not sure it makes much sense on the physical device.

charles-lunarg commented 1 year ago

Better name would be is_extension_present() - since it isn't "enabled" yet, but is present.

martty commented 1 year ago

is_extension_present sounds good!