1use serde::{Deserialize, Serialize};
5
6macro_rules! id_type {
7 ($name:ident, $doc:literal) => {
8 #[doc = $doc]
9 #[derive(
10 Copy,
11 Clone,
12 Debug,
13 Default,
14 PartialEq,
15 Eq,
16 Hash,
17 PartialOrd,
18 Ord,
19 Serialize,
20 Deserialize,
21 )]
22 #[serde(transparent)]
23 pub struct $name(pub u64);
24
25 impl $name {
26 pub fn get(self) -> u64 {
28 self.0
29 }
30 }
31
32 impl From<u64> for $name {
33 fn from(v: u64) -> Self {
34 $name(v)
35 }
36 }
37
38 impl From<$name> for u64 {
39 fn from(v: $name) -> Self {
40 v.0
41 }
42 }
43 };
44}
45
46id_type!(Seq, "Global monotonic event sequence number within a trace session.");
47id_type!(RequestId, "Correlation id for a logical request (an asset load, a frame, ...).");
48id_type!(SpanId, "Id of a begin/end span (pair of events).");
49id_type!(FileKey, "Hash of a file identity (path or object id).");
50id_type!(Epoch, "Lifetime/recycling epoch. Higher = later.");
51id_type!(OpId, "Id of an in-flight I/O or asynchronous operation.");
52id_type!(AllocId, "Id of an allocation in a staging arena.");
53id_type!(ArenaId, "Id of a staging arena.");
54
55pub type ResourceRef = (u32, u64);
58
59pub mod resource_domain {
61 pub const FILE: u32 = 1;
63 pub const D3D12_RESOURCE: u32 = 2;
65 pub const D3D12_QUEUE: u32 = 3;
67 pub const VK_OBJECT: u32 = 4;
69 pub const KATRA_ARENA: u32 = 5;
71 pub const DESCRIPTOR_HEAP: u32 = 6;
73 pub const PIPELINE: u32 = 7;
75 pub const FENCE: u32 = 8;
77}