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
#[cfg(feature = "rafx-metal")]
use crate::metal::RafxTextureMetal;
#[cfg(feature = "rafx-vulkan")]
use crate::vulkan::RafxTextureVulkan;
use crate::RafxTextureDef;
#[derive(Debug)]
pub enum RafxTexture {
#[cfg(feature = "rafx-vulkan")]
Vk(RafxTextureVulkan),
#[cfg(feature = "rafx-metal")]
Metal(RafxTextureMetal),
}
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) => unimplemented!(),
}
}
#[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(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),
}
}
}