#![warn(
missing_debug_implementations,
missing_copy_implementations,
missing_docs,
trivial_casts,
trivial_numeric_casts,
unused_extern_crates,
unused_import_braces,
unused_qualifications
)]
macro_rules! family_owned {
($type:ident<B, C $(, $args:ident)*> @ $getter:expr) => {
#[allow(unused_qualifications)]
impl<B, C $(, $args)*> $type<B, C $(, $args)*>
where
B: rendy_core::hal::Backend,
{
pub fn family_id(&self) -> $crate::FamilyId {
($getter)(self)
}
pub fn assert_family_owner(&self, family: &$crate::Family<B, C>) {
assert_eq!(self.family_id(), family.id(), "Resource is not owned by specified family");
}
pub fn assert_device_owner(&self, device: &$crate::core::Device<B>) {
assert_eq!(self.family_id().device, device.id(), "Resource is not owned by specified device");
}
pub fn assert_instance_owner(&self, instance: &$crate::core::Instance<B>) {
assert_eq!(self.family_id().device.instance, instance.id(), "Resource is not owned by specified instance");
}
}
};
($type:ident<B, C $(, $args:ident)*>) => {
family_owned!($type<B, C $(, $args)*> @ |s: &Self| s.family);
};
(@NOCAP $type:ident<B $(, $args:ident)*> @ $getter:expr) => {
#[allow(unused_qualifications)]
impl<B, $(, $args)*> $type<B, $(, $args)*>
where
B: rendy_core::hal::Backend,
{
pub fn family_id(&self) -> $crate::FamilyId {
($getter)(self)
}
pub fn assert_family_owner<C>(&self, family: &$crate::Family<B, C>) {
assert_eq!(self.family_id(), family.id(), "Resource is not owned by specified family");
}
pub fn assert_device_owner(&self, device: &$crate::core::Device<B>) {
assert_eq!(self.family_id().device, device.id(), "Resource is not owned by specified device");
}
pub fn assert_instance_owner(&self, instance: &$crate::core::Instance<B>) {
assert_eq!(self.family_id().device.instance, instance.id(), "Resource is not owned by specified instance");
}
}
};
(@NOCAP $type:ident<B, $(, $args:ident)*>) => {
family_owned!(@NOCAP $type<B, C $(, $args)*> @ |s: &Self| s.family);
};
}
use rendy_core as core;
mod buffer;
mod capability;
mod family;
mod fence;
mod pool;
pub use crate::{buffer::*, capability::*, family::*, fence::*, pool::*};