|
1 |
| -use std::ffi::CString; |
2 |
| -use std::os::raw::{c_void, c_long}; |
| 1 | +use std::os::raw::c_void; |
3 | 2 | use std::ptr;
|
4 | 3 | use std::rc::Rc;
|
5 |
| -use winapi; |
| 4 | +use mozangle::egl::ffi::*; |
6 | 5 | use winapi::um::d3d11::ID3D11Device;
|
7 | 6 | use winapi::um::d3d11::ID3D11Texture2D;
|
8 | 7 |
|
9 |
| -pub fn get_proc_address(name: &str) -> *const c_void { |
10 |
| - let name = CString::new(name.as_bytes()).unwrap(); |
11 |
| - unsafe { |
12 |
| - GetProcAddress(name.as_ptr()) as *const _ as _ |
13 |
| - } |
14 |
| -} |
| 8 | +pub use mozangle::egl::get_proc_address; |
15 | 9 |
|
16 | 10 | pub struct SharedEglThings {
|
17 | 11 | device: EGLDeviceEXT,
|
@@ -39,7 +33,7 @@ impl SharedEglThings {
|
39 | 33 | pub unsafe fn new(d3d_device: *mut ID3D11Device) -> Rc<Self> {
|
40 | 34 | let device = eglCreateDeviceANGLE(
|
41 | 35 | D3D11_DEVICE_ANGLE,
|
42 |
| - d3d_device, |
| 36 | + d3d_device as *mut c_void, |
43 | 37 | ptr::null(),
|
44 | 38 | ).check();
|
45 | 39 | let display = GetPlatformDisplayEXT(
|
@@ -174,35 +168,3 @@ impl Check for types::EGLBoolean {
|
174 | 168 | self
|
175 | 169 | }
|
176 | 170 | }
|
177 |
| - |
178 |
| -// Adapted from https://github.com/tomaka/glutin/blob/1f3b8360cb/src/api/egl/ffi.rs |
179 |
| -#[allow(non_camel_case_types)] pub type khronos_utime_nanoseconds_t = khronos_uint64_t; |
180 |
| -#[allow(non_camel_case_types)] pub type khronos_uint64_t = u64; |
181 |
| -#[allow(non_camel_case_types)] pub type khronos_ssize_t = c_long; |
182 |
| -pub type EGLint = i32; |
183 |
| -pub type EGLNativeDisplayType = *const c_void; |
184 |
| -pub type EGLNativePixmapType = *const c_void; |
185 |
| -pub type EGLNativeWindowType = winapi::shared::windef::HWND; |
186 |
| -pub type NativeDisplayType = EGLNativeDisplayType; |
187 |
| -pub type NativePixmapType = EGLNativePixmapType; |
188 |
| -pub type NativeWindowType = EGLNativeWindowType; |
189 |
| - |
190 |
| -include!(concat!(env!("OUT_DIR"), "/egl_bindings.rs")); |
191 |
| - |
192 |
| - |
193 |
| -// Adapted from https://chromium.googlesource.com/angle/angle/+/master/include/EGL/eglext_angle.h |
194 |
| -type EGLDeviceEXT = *mut c_void; |
195 |
| -const EXPERIMENTAL_PRESENT_PATH_ANGLE: types::EGLenum = 0x33A4; |
196 |
| -const EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE: types::EGLenum = 0x33A9; |
197 |
| -const D3D_TEXTURE_ANGLE: types::EGLenum = 0x33A3; |
198 |
| -const FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE: types::EGLenum = 0x33A6; |
199 |
| - |
200 |
| -extern "C" { |
201 |
| - fn eglCreateDeviceANGLE( |
202 |
| - device_type: types::EGLenum, |
203 |
| - device: *mut ID3D11Device, |
204 |
| - attrib_list: *const types::EGLAttrib, |
205 |
| - ) -> EGLDeviceEXT; |
206 |
| - |
207 |
| - fn eglReleaseDeviceANGLE(device: EGLDeviceEXT) -> types::EGLBoolean; |
208 |
| -} |
0 commit comments