Open Neo-Zhixing opened 2 months ago
One additional thing we can do: Exposing the meta types directly on ash::khr::*
. So instead of ash::khr::acceleration_structure::Meta
you can write ash::khr::AccelerationStructure
. And as long as the ExtensionMeta
trait is in scope, you can also write ash::khr::AccelerationStructure::Device
@Ralith @MarijnS95 any chances for this to be adopted?
Supersedes #912
Create new marker traits
ExtensionMeta
as defined below:Add marker struct
Meta
in all extension mod root.ExtensionMeta
trait is automatically implemented for allMeta
marker structs.When an extension does not have Instance or Device fp, the corresponding associated types on the trait will be defined as the unit type
()
.Why is this useful?
Higher level abstractions may want to offer a way for users to enable extensions during application startup. Instead of asking for a
&'static CStr
extension name, we could instead ask for animpl ExtensionMeta
which is significantly more idiomatic. This also gives us the promotion status of an extension, which allows the framework to behave differently depending on the core Vulkan version.Unfortunately, we cannot implement traits for modules. That's why we need the extra
Meta
type that we added on module roots. These types give us a way to refer to the whole extension as a type.