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()
.filter_map(|(index, ref info)| {
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(
*pdevice,
index as u32,
@ -410,7 +410,7 @@ impl ExampleBase {
};
let pre_transform = if surface_capabilities
.supported_transforms
.subset(vk::SurfaceTransformFlagsKHR::IDENTITY)
.contains(vk::SurfaceTransformFlagsKHR::IDENTITY)
{
vk::SurfaceTransformFlagsKHR::IDENTITY
} else {

View file

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