Description
Currently, Ash has separate structures for each extension, which means each one has to be loaded and kept around by the user. This is a bit awkward if there's many extensions involved, so what if the extension functions were implemented directly on Instance
and Device
instead? The user would only have to keep these two structures around for all their use cases.
These two objects would initialise the function pointers of all extensions internally when they are created. This is allowed by the spec; the spec dictates that asking for the pointer to an extension function that has not been requested at create time should return a null pointer. Ash itself already does this for the Vulkan core functions, which are all loaded regardless of whether the user created their Instance for that version.
If this is done, I also suggest getting rid of the DeviceV1_0
trait and others like it, and implementing functions (both core and extension) as inherent methods on Instance
and Device
. These traits add extra flexibility but I'm not sure if that's actually needed for most people. And if each extension is going to be represented as a trait on Instance
or Device
, those two types end up with a very long list of trait implementations. You could keep the functions for returning the raw function pointer structs as they are now, or expose each function struct member of Instance
and Device
to the user directly; the latter has my preference.