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
use std::ptr;
use crate::*;
pub enum Headless {}
impl Graphics for Headless {
type Requirements = ();
type Format = void::Void;
type SessionCreateInfo = ();
type SwapchainImage = void::Void;
fn raise_format(_: i64) -> Self::Format {
panic!("tried to construct a headless image format")
}
fn lower_format(x: Self::Format) -> i64 {
void::unreachable(x)
}
fn requirements(_: &Instance, _: SystemId) -> Result<()> {
Ok(())
}
unsafe fn create_session(
instance: &Instance,
system: SystemId,
_: &Self::SessionCreateInfo,
) -> Result<sys::Session> {
let info = sys::SessionCreateInfo {
ty: sys::SessionCreateInfo::TYPE,
next: ptr::null(),
create_flags: Default::default(),
system_id: system,
};
let mut out = sys::Session::NULL;
cvt((instance.fp().create_session)(
instance.as_raw(),
&info,
&mut out,
))?;
Ok(out)
}
fn enumerate_swapchain_images(_: &Swapchain<Self>) -> Result<Vec<Self::SwapchainImage>> {
Ok(Vec::new())
}
}