Skip to content

Commit

Permalink
Merge pull request #1082 from ids1024/angle
Browse files Browse the repository at this point in the history
egl: Support ANGLE EGL platform on winit Wayland
  • Loading branch information
Drakulix authored Jul 19, 2023
2 parents b54598f + 2f00e12 commit ae7fb22
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/backend/egl/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,9 @@ pub mod egl {
// Accepted in the <attribute> parameter of eglQueryWaylandBufferWL:
pub const EGL_TEXTURE_FORMAT: i32 = 0x3080;
pub const WAYLAND_Y_INVERTED_WL: i32 = 0x31DB;

pub const PLATFORM_ANGLE_ANGLE: u32 = 0x3202;
pub const PLATFORM_ANGLE_TYPE_ANGLE: i32 = 0x3203;
pub const PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE: i32 = 0x348F;
pub const PLATFORM_ANGLE_TYPE_VULKAN_ANGLE: i32 = 0x3450;
}
30 changes: 30 additions & 0 deletions src/backend/egl/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,43 @@ impl EGLNativeDisplay for Arc<WinitWindow> {
egl_platform!(PLATFORM_WAYLAND_KHR, display, &["EGL_KHR_platform_wayland"]),
// see: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_platform_wayland.txt
egl_platform!(PLATFORM_WAYLAND_EXT, display, &["EGL_EXT_platform_wayland"]),
// see: https://raw.githubusercontent.com/google/angle/main/extensions/EGL_ANGLE_platform_angle.txt
egl_platform!(
PLATFORM_ANGLE_ANGLE,
display,
&[
"EGL_ANGLE_platform_angle",
"EGL_ANGLE_platform_angle_vulkan",
"EGL_EXT_platform_wayland",
],
vec![
ffi::egl::PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE,
ffi::egl::PLATFORM_WAYLAND_EXT as _,
ffi::egl::PLATFORM_ANGLE_TYPE_ANGLE,
ffi::egl::PLATFORM_ANGLE_TYPE_VULKAN_ANGLE,
ffi::egl::NONE as ffi::EGLint
]
),
]
} else if let Some(display) = self.xlib_display() {
vec![
// see: https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_platform_x11.txt
egl_platform!(PLATFORM_X11_KHR, display, &["EGL_KHR_platform_x11"]),
// see: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_platform_x11.txt
egl_platform!(PLATFORM_X11_EXT, display, &["EGL_EXT_platform_x11"]),
// see: https://raw.githubusercontent.com/google/angle/main/extensions/EGL_ANGLE_platform_angle.txt
egl_platform!(
PLATFORM_ANGLE_ANGLE,
display,
&["EGL_ANGLE_platform_angle", "EGL_ANGLE_platform_angle_vulkan"],
vec![
ffi::egl::PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE,
ffi::egl::PLATFORM_X11_EXT as _,
ffi::egl::PLATFORM_ANGLE_TYPE_ANGLE,
ffi::egl::PLATFORM_ANGLE_TYPE_VULKAN_ANGLE,
ffi::egl::NONE as ffi::EGLint
]
),
]
} else {
unreachable!("No backends for winit other then Wayland and X11 are supported")
Expand Down

0 comments on commit ae7fb22

Please sign in to comment.