Merge branch 'Ralith-flags-api' into generator

This commit is contained in:
Maik Klein 2018-11-11 14:37:39 +01:00
commit e3cd98ab9d
3 changed files with 2493 additions and 1144 deletions

File diff suppressed because it is too large Load diff

View file

@ -333,7 +333,7 @@ impl ExampleBase {
.enumerate() .enumerate()
.filter_map(|(index, ref info)| { .filter_map(|(index, ref info)| {
let supports_graphic_and_surface = let supports_graphic_and_surface =
info.queue_flags.subset(vk::QueueFlags::GRAPHICS) && surface_loader info.queue_flags.contains(vk::QueueFlags::GRAPHICS) && surface_loader
.get_physical_device_surface_support_khr( .get_physical_device_surface_support_khr(
*pdevice, *pdevice,
index as u32, index as u32,
@ -410,7 +410,7 @@ impl ExampleBase {
}; };
let pre_transform = if surface_capabilities let pre_transform = if surface_capabilities
.supported_transforms .supported_transforms
.subset(vk::SurfaceTransformFlagsKHR::IDENTITY) .contains(vk::SurfaceTransformFlagsKHR::IDENTITY)
{ {
vk::SurfaceTransformFlagsKHR::IDENTITY vk::SurfaceTransformFlagsKHR::IDENTITY
} else { } else {

View file

@ -223,23 +223,10 @@ pub fn vk_bitflags_wrapped_macro() -> Tokens {
} }
#[inline] #[inline]
pub fn flags(self) -> $flag_type { pub fn from_raw(x: $flag_type) -> Self { $name(x) }
self.0
}
#[inline] #[inline]
pub fn from_flags(flags: $flag_type) -> Option<$name> { pub fn as_raw(self) -> $flag_type { self.0 }
if flags & !$all == 0 {
Some($name(flags))
} else {
None
}
}
#[inline]
pub fn from_flags_truncate(flags: $flag_type) -> $name {
$name (flags & $all)
}
#[inline] #[inline]
pub fn is_empty(self) -> bool { pub fn is_empty(self) -> bool {
@ -256,9 +243,9 @@ pub fn vk_bitflags_wrapped_macro() -> Tokens {
self & other != $name::empty() self & other != $name::empty()
} }
/// Returns true of `other` is a subset of `self` /// Returns whether `other` is a subset of `self`
#[inline] #[inline]
pub fn subset(self, other: $name) -> bool { pub fn contains(self, other: $name) -> bool {
self & other == other self & other == other
} }
} }