Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

egl: Support ANGLE EGL platform on winit Wayland #1082

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Drakulix marked this conversation as resolved.
Show resolved Hide resolved
}
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
Loading