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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#[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),
}
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) => unimplemented!(),
}
}
pub fn texture(&self) -> &RafxTexture {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxRenderTarget::Vk(inner) => inner.texture(),
#[cfg(feature = "rafx-metal")]
RafxRenderTarget::Metal(_inner) => unimplemented!(),
}
}
pub(crate) fn render_target_id(&self) -> u32 {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxRenderTarget::Vk(inner) => inner.render_target_id(),
#[cfg(feature = "rafx-metal")]
RafxRenderTarget::Metal(_inner) => unimplemented!(),
}
}
pub(crate) fn take_is_undefined_layout(&self) -> bool {
match self {
#[cfg(feature = "rafx-vulkan")]
RafxRenderTarget::Vk(inner) => inner.take_is_undefined_layout(),
#[cfg(feature = "rafx-metal")]
RafxRenderTarget::Metal(_inner) => unimplemented!(),
}
}
#[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(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),
}
}
}