Add ExtensionMeta traits#913
Closed
PixelDust22 wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
One additional thing we can do: Exposing the meta types directly on |
filnet
reviewed
Apr 25, 2024
| let vk_parse::Extension { | ||
| name: full_extension_name, | ||
| children: items, | ||
| promotedto, |
Contributor
Author
There was a problem hiding this comment.
This is defined in vk_parse. We can probably rename it to promoted_to in our code if that makes you happy
Contributor
Author
|
@Ralith @MarijnS95 any chances for this to be adopted? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #912
Create new marker traits
ExtensionMetaas defined below:Add marker struct
Metain all extension mod root.ExtensionMetatrait is automatically implemented for allMetamarker 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 CStrextension name, we could instead ask for animpl ExtensionMetawhich 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
Metatype that we added on module roots. These types give us a way to refer to the whole extension as a type.