-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RequiresAllOf
, automatically enable required extensions and features
#2233
Conversation
Why did you revert #2205? |
I was confused that |
I think it should work like it did before, with |
But how should it be formatted, now that there's multiple layers of requirements? |
Actually looking at the code, I'm even more confused. There is a custom |
If you want I can do the formatting, I have a clear picture in mind. There's some more serious issues I think I found here that you should address. |
Yes please. |
I was trying to debug it but you'll know better than me. If you look at the build output of |
Do you get a compile error? It looks normal on my end: pub(super) fn check_requirements(
&self,
supported: &DeviceExtensions,
api_version: crate::Version,
instance_extensions: &crate::instance::InstanceExtensions,
) -> Result<(), crate::ValidationError> {
if self.khr_16bit_storage {
if !supported.khr_16bit_storage {
return Err (crate :: ValidationError { problem : "contains `khr_16bit_storage`, but this extension is not supported by the physical device" . into () , .. Default :: default () }) ;
}
if !(api_version >= crate::Version::V1_1
|| instance_extensions.khr_get_physical_device_properties2)
{
return Err(crate::ValidationError {
problem: "contains `khr_16bit_storage`".into(),
requires_one_of: crate::RequiresOneOf(&[
crate::RequiresAllOf(&[crate::Requires::APIVersion(crate::Version::V1_1)]),
crate::RequiresAllOf(&[crate::Requires::InstanceExtension(
"khr_get_physical_device_properties2",
)]),
]),
..Default::default()
});
}
if !(api_version >= crate::Version::V1_1) {
return Err(crate::ValidationError {
problem: "contains `khr_16bit_storage`".into(),
requires_one_of: crate::RequiresOneOf(&[crate::RequiresAllOf(&[
crate::Requires::APIVersion(crate::Version::V1_1),
])]),
..Default::default()
});
}
} etc. |
No there's no compile error, the checks it does are not correct. |
Will you mind if I push the formatting changes directly to your branch? I could also open a PR to your branch but lazy >.> |
Yes, go ahead. Are you talking about the device extensions required by other device extensions? Those checks are gone because they're automatically enabled now. |
Ah never mind, I think I see what's going on. |
I made a fix. Whenever a device extension was one of the alternatives, since we're always able to enable that extension, we can treat that alternative as |
I added the Unwrapping a
I checked the
|
Is there anything else I need to do? |
Do you approve of the commit I added? |
Yeah, it's fine. |
Alrighty, then it looks to me like this is good to go. Thank you for the work! |
…tures (vulkano-rs#2233) * Add `RequiresAllOf`, automatically enable required extensions and features * Add more missing backticks and backslashes to error messages * Use updated VUIDs that require `acceleration_structure` * Fix `check_requirements` * Cooperation go brr --------- Co-authored-by: marc0246 <40955683+marc0246@users.noreply.github.com>
Changelog:
This adds the ability to specify multiple requirements that must be enabled together, using
RequiresAllOf
. This is needed for some parts of the API, such asvkAcquireNextImage2KHR
andvkGetPhysicalDevicePresentRectanglesKHR
.RequiresOneOf
now contains a slice ofRequiresAllOf
, which in turns contains a slice ofRequires
enums. In other words, requirements now follow a DNF structure.Additionally, I added the automatic enabling of required extensions and features. This is purely a convenience for the user, but hopefully one that makes dealing with extensions less frustrating, by letting the user focus on what they actually need.