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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
use crate::empty::RafxRootSignatureEmpty;
#[cfg(feature = "rafx-metal")]
use crate::metal::RafxRootSignatureMetal;
#[cfg(feature = "rafx-vulkan")]
use crate::vulkan::RafxRootSignatureVulkan;
use crate::RafxPipelineType;
#[derive(Clone, Debug)]
pub enum RafxRootSignature {
#[cfg(feature = "rafx-vulkan")]
Vk(RafxRootSignatureVulkan),
#[cfg(feature = "rafx-metal")]
Metal(RafxRootSignatureMetal),
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
Empty(RafxRootSignatureEmpty),
}
impl RafxRootSignature {
pub fn pipeline_type(&self) -> RafxPipelineType {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxRootSignature::Vk(inner) => inner.pipeline_type(),
#[cfg(feature = "rafx-metal")]
RafxRootSignature::Metal(inner) => inner.pipeline_type(),
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
RafxRootSignature::Empty(inner) => inner.pipeline_type(),
}
}
#[cfg(feature = "rafx-vulkan")]
pub fn vk_root_signature(&self) -> Option<&RafxRootSignatureVulkan> {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxRootSignature::Vk(inner) => Some(inner),
#[cfg(feature = "rafx-metal")]
RafxRootSignature::Metal(_inner) => None,
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
RafxRootSignature::Empty(_inner) => None,
}
}
#[cfg(feature = "rafx-metal")]
pub fn metal_root_signature(&self) -> Option<&RafxRootSignatureMetal> {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxRootSignature::Vk(_inner) => None,
#[cfg(feature = "rafx-metal")]
RafxRootSignature::Metal(inner) => Some(inner),
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
RafxRootSignature::Empty(_inner) => None,
}
}
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
pub fn empty_root_signature(&self) -> Option<&RafxRootSignatureEmpty> {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxRootSignature::Vk(_inner) => None,
#[cfg(feature = "rafx-metal")]
RafxRootSignature::Metal(_inner) => None,
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
RafxRootSignature::Empty(inner) => Some(inner),
}
}
}