mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 16:25:31 +00:00
Rename Features::superset_of
to is_superset_of
, add is_superset_of
to extensions (#1625)
This commit is contained in:
parent
9b667128d7
commit
aee11063d4
@ -36,7 +36,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
// The Vulkan specs guarantee that a compliant implementation must provide at least one queue
|
||||
// that supports compute operations.
|
||||
|
@ -63,7 +63,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
|
@ -117,7 +117,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
Some(
|
||||
p.queue_families()
|
||||
|
@ -64,7 +64,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
|
@ -38,7 +38,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
|
@ -51,7 +51,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
|
@ -54,7 +54,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
|
@ -33,7 +33,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
|
@ -79,7 +79,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
|
@ -76,7 +76,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
|
@ -98,7 +98,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics())
|
||||
|
@ -75,9 +75,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
p.supported_extensions().intersection(&device_extensions) == device_extensions
|
||||
})
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
|
@ -65,10 +65,10 @@ fn main() {
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| {
|
||||
p.supported_extensions().intersection(&device_extensions) == device_extensions
|
||||
p.supported_extensions().is_superset_of(&device_extensions)
|
||||
})
|
||||
.filter(|&p| {
|
||||
p.supported_features().superset_of(&features)
|
||||
p.supported_features().is_superset_of(&features)
|
||||
})
|
||||
.filter(|&p| {
|
||||
// This example renders to two layers of the framebuffer using the multiview
|
||||
|
@ -49,7 +49,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
|
@ -49,7 +49,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
|
@ -29,7 +29,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
|
@ -76,7 +76,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
|
@ -30,7 +30,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
|
@ -29,7 +29,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_compute())
|
||||
|
@ -56,7 +56,7 @@ fn main() {
|
||||
..DeviceExtensions::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
|
@ -155,8 +155,8 @@ fn main() {
|
||||
..Features::none()
|
||||
};
|
||||
let (physical_device, queue_family) = PhysicalDevice::enumerate(&instance)
|
||||
.filter(|&p| p.supported_extensions().intersection(&device_extensions) == device_extensions)
|
||||
.filter(|&p| p.supported_features().superset_of(&features))
|
||||
.filter(|&p| p.supported_extensions().is_superset_of(&device_extensions))
|
||||
.filter(|&p| p.supported_features().is_superset_of(&features))
|
||||
.filter_map(|p| {
|
||||
p.queue_families()
|
||||
.find(|&q| q.supports_graphics() && surface.is_supported(q).unwrap_or(false))
|
||||
|
@ -82,7 +82,7 @@ fn main() {
|
||||
// Some devices may not support the extensions or features that your application, or
|
||||
// report properties and limits that are not sufficient for your application. These
|
||||
// should be filtered out here.
|
||||
p.supported_extensions().intersection(&device_extensions) == device_extensions
|
||||
p.supported_extensions().is_superset_of(&device_extensions)
|
||||
})
|
||||
.filter_map(|p| {
|
||||
// For each physical device, we try to find a suitable queue family that will execute
|
||||
|
@ -43,11 +43,11 @@ macro_rules! features {
|
||||
/// .. Features::none()
|
||||
/// };
|
||||
///
|
||||
/// if !physical_device.supported_features().superset_of(&minimal_features) {
|
||||
/// if !physical_device.supported_features().is_superset_of(&minimal_features) {
|
||||
/// panic!("The physical device is not good enough for this application.");
|
||||
/// }
|
||||
///
|
||||
/// assert!(optimal_features.superset_of(&minimal_features));
|
||||
/// assert!(optimal_features.is_superset_of(&minimal_features));
|
||||
/// let features_to_request = optimal_features.intersection(physical_device.supported_features());
|
||||
/// ```
|
||||
///
|
||||
@ -130,7 +130,7 @@ macro_rules! features {
|
||||
///
|
||||
/// That is, for each feature of the parameter that is true, the corresponding value
|
||||
/// in self is true as well.
|
||||
pub fn superset_of(&self, other: &Features) -> bool {
|
||||
pub fn is_superset_of(&self, other: &Features) -> bool {
|
||||
$((self.$member == true || other.$member == false))&&+
|
||||
}
|
||||
|
||||
|
@ -985,7 +985,7 @@ mod tests {
|
||||
|
||||
let features = Features::all();
|
||||
// In the unlikely situation where the device supports everything, we ignore the test.
|
||||
if physical.supported_features().superset_of(&features) {
|
||||
if physical.supported_features().is_superset_of(&features) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,14 @@ macro_rules! extensions {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if `self` is a superset of the parameter.
|
||||
///
|
||||
/// That is, for each extension of the parameter that is true, the corresponding value
|
||||
/// in self is true as well.
|
||||
pub fn is_superset_of(&self, other: &$sname) -> bool {
|
||||
$((self.$member == true || other.$member == false))&&+
|
||||
}
|
||||
|
||||
/// Returns the union of this list and another list.
|
||||
#[inline]
|
||||
pub const fn union(&self, other: &$sname) -> $sname {
|
||||
|
@ -57,7 +57,7 @@ macro_rules! gfx_dev_and_queue {
|
||||
};
|
||||
|
||||
// If the physical device doesn't support the requested features, just return.
|
||||
if !physical.supported_features().superset_of(&features) {
|
||||
if !physical.supported_features().is_superset_of(&features) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user