#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
use crate::empty::RafxTextureEmpty;
#[cfg(feature = "rafx-metal")]
use crate::metal::RafxTextureMetal;
#[cfg(feature = "rafx-vulkan")]
use crate::vulkan::RafxTextureVulkan;
use crate::RafxTextureDef;
#[derive(Clone, Debug)]
pub enum RafxTexture {
#[cfg(feature = "rafx-vulkan")]
Vk(RafxTextureVulkan),
#[cfg(feature = "rafx-metal")]
Metal(RafxTextureMetal),
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
Empty(RafxTextureEmpty),
}
impl RafxTexture {
pub fn texture_def(&self) -> &RafxTextureDef {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxTexture::Vk(inner) => inner.texture_def(),
#[cfg(feature = "rafx-metal")]
RafxTexture::Metal(inner) => inner.texture_def(),
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
RafxTexture::Empty(inner) => inner.texture_def(),
}
}
#[cfg(feature = "rafx-vulkan")]
pub fn vk_texture(&self) -> Option<&RafxTextureVulkan> {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxTexture::Vk(inner) => Some(inner),
#[cfg(feature = "rafx-metal")]
RafxTexture::Metal(_inner) => None,
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
RafxTexture::Empty(_inner) => None,
}
}
#[cfg(feature = "rafx-metal")]
pub fn metal_texture(&self) -> Option<&RafxTextureMetal> {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxTexture::Vk(_inner) => None,
#[cfg(feature = "rafx-metal")]
RafxTexture::Metal(inner) => Some(inner),
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
RafxTexture::Empty(_inner) => None,
}
}
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
pub fn empty_texture(&self) -> Option<&RafxTextureEmpty> {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxTexture::Vk(_inner) => None,
#[cfg(feature = "rafx-metal")]
RafxTexture::Metal(_inner) => None,
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
RafxTexture::Empty(inner) => Some(inner),
}
}
}