Skip to content

Commit 3852467

Browse files
committed
feat: graphics bindings
1 parent 0c75305 commit 3852467

2 files changed

Lines changed: 70 additions & 1 deletion

File tree

openxr/src/graphics/opengl.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,35 @@ impl Graphics for OpenGL {
118118
))?;
119119
Ok(out)
120120
}
121+
SessionCreateInfo::Egl {
122+
display,
123+
config,
124+
context,
125+
get_proc_address,
126+
} => {
127+
let binding = sys::GraphicsBindingEGLMNDX {
128+
ty: sys::GraphicsBindingEGLMNDX::TYPE,
129+
next: ptr::null(),
130+
display,
131+
config,
132+
context,
133+
get_proc_address: Some(get_proc_address),
134+
};
135+
let info = sys::SessionCreateInfo {
136+
ty: sys::SessionCreateInfo::TYPE,
137+
next: &binding as *const _ as *const _,
138+
create_flags: Default::default(),
139+
system_id: system,
140+
};
141+
let mut out = sys::Session::NULL;
142+
cvt((instance.fp().create_session)(
143+
instance.as_raw(),
144+
&info,
145+
&mut out,
146+
))?;
147+
148+
Ok(out)
149+
}
121150
}
122151
}
123152

@@ -150,6 +179,12 @@ pub struct Requirements {
150179
}
151180

152181
pub enum SessionCreateInfo {
182+
Egl {
183+
display: EGLDisplay,
184+
config: EGLConfig,
185+
context: EGLContext,
186+
get_proc_address: EglGetProcAddressMNDX,
187+
},
153188
Xlib {
154189
x_display: *mut Display,
155190
visualid: u32,

openxr/src/graphics/opengles.rs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::ptr;
22

3-
#[cfg(target_os = "android")]
43
use sys::platform::*;
54

65
use crate::*;
@@ -73,6 +72,35 @@ impl Graphics for OpenGlEs {
7372
&mut out,
7473
))?;
7574

75+
Ok(out)
76+
}
77+
SessionCreateInfo::Egl {
78+
display,
79+
config,
80+
context,
81+
get_proc_address,
82+
} => {
83+
let binding = sys::GraphicsBindingEGLMNDX {
84+
ty: sys::GraphicsBindingEGLMNDX::TYPE,
85+
next: ptr::null(),
86+
display,
87+
config,
88+
context,
89+
get_proc_address: Some(get_proc_address),
90+
};
91+
let info = sys::SessionCreateInfo {
92+
ty: sys::SessionCreateInfo::TYPE,
93+
next: &binding as *const _ as *const _,
94+
create_flags: Default::default(),
95+
system_id: system,
96+
};
97+
let mut out = sys::Session::NULL;
98+
cvt((instance.fp().create_session)(
99+
instance.as_raw(),
100+
&info,
101+
&mut out,
102+
))?;
103+
76104
Ok(out)
77105
}
78106
}
@@ -113,4 +141,10 @@ pub enum SessionCreateInfo {
113141
config: EGLConfig,
114142
context: EGLContext,
115143
},
144+
Egl {
145+
display: EGLDisplay,
146+
config: EGLConfig,
147+
context: EGLContext,
148+
get_proc_address: EglGetProcAddressMNDX,
149+
},
116150
}

0 commit comments

Comments
 (0)