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
#[cfg(any(
    feature = "rafx-empty",
    not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
use crate::empty::RafxShaderModuleEmpty;
#[cfg(feature = "rafx-metal")]
use crate::metal::RafxShaderModuleMetal;
#[cfg(feature = "rafx-vulkan")]
use crate::vulkan::RafxShaderModuleVulkan;
#[derive(Clone, Debug)]
pub enum RafxShaderModule {
    #[cfg(feature = "rafx-vulkan")]
    Vk(RafxShaderModuleVulkan),
    #[cfg(feature = "rafx-metal")]
    Metal(RafxShaderModuleMetal),
    #[cfg(any(
        feature = "rafx-empty",
        not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
    ))]
    Empty(RafxShaderModuleEmpty),
}
impl RafxShaderModule {
    
    
    #[cfg(feature = "rafx-vulkan")]
    pub fn vk_shader_module(&self) -> Option<&RafxShaderModuleVulkan> {
        match self {
            #[cfg(feature = "rafx-vulkan")]
            RafxShaderModule::Vk(shader_module) => Some(shader_module),
            #[cfg(feature = "rafx-metal")]
            RafxShaderModule::Metal(_shader_module) => None,
            #[cfg(any(
                feature = "rafx-empty",
                not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
            ))]
            RafxShaderModule::Empty(_shader_module) => None,
        }
    }
    
    
    #[cfg(feature = "rafx-metal")]
    pub fn metal_shader_module(&self) -> Option<&RafxShaderModuleMetal> {
        match self {
            #[cfg(feature = "rafx-vulkan")]
            RafxShaderModule::Vk(_shader_module) => None,
            #[cfg(feature = "rafx-metal")]
            RafxShaderModule::Metal(shader_module) => Some(shader_module),
            #[cfg(any(
                feature = "rafx-empty",
                not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
            ))]
            RafxShaderModule::Empty(_shader_module) => None,
        }
    }
    
    
    #[cfg(any(
        feature = "rafx-empty",
        not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
    ))]
    pub fn empty_shader_module(&self) -> Option<&RafxShaderModuleEmpty> {
        match self {
            #[cfg(feature = "rafx-vulkan")]
            RafxShaderModule::Vk(_shader_module) => None,
            #[cfg(feature = "rafx-metal")]
            RafxShaderModule::Metal(_shader_module) => None,
            #[cfg(any(
                feature = "rafx-empty",
                not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
            ))]
            RafxShaderModule::Empty(shader_module) => Some(shader_module),
        }
    }
}