#[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),
}
}
}