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