#[macro_export]
macro_rules! declare_render_phase {
($struct_name:ident, $atomic_constant_name:ident, $sort_fn:ident) => {
static $atomic_constant_name: std::sync::atomic::AtomicI32 =
std::sync::atomic::AtomicI32::new(-1);
pub struct $struct_name;
impl RenderPhase for $struct_name {
fn set_render_phase_index(index: RenderPhaseIndex) {
use std::convert::TryInto;
$atomic_constant_name.store(
index.try_into().unwrap(),
std::sync::atomic::Ordering::Release,
);
}
fn render_phase_index() -> RenderPhaseIndex {
$atomic_constant_name.load(std::sync::atomic::Ordering::Acquire) as RenderPhaseIndex
}
fn sort_submit_nodes(submit_nodes: Vec<SubmitNode>) -> Vec<SubmitNode> {
$sort_fn(submit_nodes)
}
fn render_phase_debug_name() -> &'static str {
stringify!($struct_name)
}
}
};
}