#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
use crate::empty::RafxRenderTargetEmpty;
#[cfg(feature = "rafx-metal")]
use crate::metal::RafxRenderTargetMetal;
#[cfg(feature = "rafx-vulkan")]
use crate::vulkan::RafxRenderTargetVulkan;
use crate::{RafxRenderTargetDef, RafxTexture};
#[derive(Clone, Debug)]
pub enum RafxRenderTarget {
#[cfg(feature = "rafx-vulkan")]
Vk(RafxRenderTargetVulkan),
#[cfg(feature = "rafx-metal")]
Metal(RafxRenderTargetMetal),
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
Empty(RafxRenderTargetEmpty),
}
impl RafxRenderTarget {
pub fn render_target_def(&self) -> &RafxRenderTargetDef {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxRenderTarget::Vk(inner) => inner.render_target_def(),
#[cfg(feature = "rafx-metal")]
RafxRenderTarget::Metal(inner) => inner.render_target_def(),
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
RafxRenderTarget::Empty(inner) => inner.render_target_def(),
}
}
pub fn texture(&self) -> &RafxTexture {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxRenderTarget::Vk(inner) => inner.texture(),
#[cfg(feature = "rafx-metal")]
RafxRenderTarget::Metal(inner) => inner.texture(),
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
RafxRenderTarget::Empty(inner) => inner.texture(),
}
}
#[cfg(feature = "rafx-vulkan")]
pub fn vk_render_target(&self) -> Option<&RafxRenderTargetVulkan> {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxRenderTarget::Vk(inner) => Some(inner),
#[cfg(feature = "rafx-metal")]
RafxRenderTarget::Metal(_inner) => None,
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
RafxRenderTarget::Empty(_inner) => None,
}
}
#[cfg(feature = "rafx-metal")]
pub fn metal_render_target(&self) -> Option<&RafxRenderTargetMetal> {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxRenderTarget::Vk(_inner) => None,
#[cfg(feature = "rafx-metal")]
RafxRenderTarget::Metal(inner) => Some(inner),
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
RafxRenderTarget::Empty(_inner) => None,
}
}
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
pub fn empty_render_target(&self) -> Option<&RafxRenderTargetEmpty> {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxRenderTarget::Vk(_inner) => None,
#[cfg(feature = "rafx-metal")]
RafxRenderTarget::Metal(_inner) => None,
#[cfg(any(
feature = "rafx-empty",
not(any(feature = "rafx-metal", feature = "rafx-vulkan"))
))]
RafxRenderTarget::Empty(inner) => Some(inner),
}
}
}