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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use core::fmt;
macro_rules! define_id {
($(#[$meta:meta])* $name:ident) => {
$(#[$meta])*
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(transparent)]
pub struct $name(u32);
impl $name {
pub(crate) const fn new(value: u32) -> Self {
Self(value)
}
/// Returns the capture-local numeric identity.
pub const fn get(self) -> u32 {
self.0
}
}
impl fmt::Display for $name {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
};
}
define_id!(
/// Recording-local identity of a logical resource.
ResourceId
);
define_id!(
/// Recording-local identity of a logical texture view.
ViewId
);
define_id!(
/// Recording-local identity of a graph node/pass.
PassId
);
define_id!(
/// Recording-local identity of a declared resource access.
AccessId
);
define_id!(
/// Recording-local identity of a logical content value.
ValueId
);
define_id!(
/// Compilation-local identity of a physical allocation.
AllocationId
);
define_id!(
/// Recording-local identity of a diagnostic debug group.
DebugGroupId
);