1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#[macro_export]
macro_rules! declare_render_feature {
($struct_name:ident, $atomic_constant_name:ident) => {
static $atomic_constant_name: std::sync::atomic::AtomicI32 =
std::sync::atomic::AtomicI32::new(-1);
pub struct $struct_name;
impl RenderFeature for $struct_name {
fn set_feature_index(index: RenderFeatureIndex) {
$atomic_constant_name.store(
index.try_into().unwrap(),
std::sync::atomic::Ordering::Release,
);
}
fn feature_index() -> RenderFeatureIndex {
$atomic_constant_name.load(std::sync::atomic::Ordering::Acquire)
as RenderFeatureIndex
}
fn feature_debug_name() -> &'static str {
stringify!($struct_name)
}
}
};
}