use utils::vk_traits::*;
#[derive(Debug, Clone)]
pub struct VkQueryResultFlags {
pub _64: bool,
pub wait: bool,
pub with_availability: bool,
pub partial: bool,
}
#[doc(hidden)]
pub type RawVkQueryResultFlags = u32;
impl VkWrappedType<RawVkQueryResultFlags> for VkQueryResultFlags {
fn vk_to_raw(src: &VkQueryResultFlags, dst: &mut RawVkQueryResultFlags) {
*dst = 0;
if src._64 { *dst |= 0x00000001; }
if src.wait { *dst |= 0x00000002; }
if src.with_availability { *dst |= 0x00000004; }
if src.partial { *dst |= 0x00000008; }
}
}
impl VkRawType<VkQueryResultFlags> for RawVkQueryResultFlags {
fn vk_to_wrapped(src: &RawVkQueryResultFlags) -> VkQueryResultFlags {
VkQueryResultFlags {
_64: (src & 0x00000001) != 0,
wait: (src & 0x00000002) != 0,
with_availability: (src & 0x00000004) != 0,
partial: (src & 0x00000008) != 0,
}
}
}
impl Default for VkQueryResultFlags {
fn default() -> VkQueryResultFlags {
VkQueryResultFlags {
_64: false,
wait: false,
with_availability: false,
partial: false,
}
}
}
impl VkQueryResultFlags {
pub fn none() -> Self {
VkQueryResultFlags {
_64: false,
wait: false,
with_availability: false,
partial: false,
}
}
pub fn all() -> Self {
VkQueryResultFlags {
_64: true,
wait: true,
with_availability: true,
partial: true,
}
}
pub fn to_u32(&self) -> u32 {
0
+ if self._64 { 0x00000001 } else { 0 }
+ if self.wait { 0x00000002 } else { 0 }
+ if self.with_availability { 0x00000004 } else { 0 }
+ if self.partial { 0x00000008 } else { 0 }
}
pub fn from_u32(value: u32) -> Self {
VkQueryResultFlags {
_64: value & 0x00000001 > 0,
wait: value & 0x00000002 > 0,
with_availability: value & 0x00000004 > 0,
partial: value & 0x00000008 > 0,
}
}
}
#[doc(hidden)]
#[macro_export]
macro_rules! VkQueryResultFlags {
( $( $x:ident ),* ) => {
VkQueryResultFlags {
$($x: true,)*
..VkQueryResultFlags::none()
}
}
}