Skip to content

Commit

Permalink
Modified changelog entry and the inlined sanitization.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kilika authored and Kilika committed Sep 5, 2024
1 parent 21d0172 commit cb7d8b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- Fixed EGL's `Device::query_devices()` being too strict about required extensions
- Fixed crash in `EglGetProcAddress` on Win32-x86 platform due to wrong calling convention
- Implement a workaround for EGL's `Display::new()` making an `EGLDisplay::Khr` when the underlying platform only supports `EGLDisplay::Ext` due to `libglvnd` using the same vendor functions for obtaining a display connection for both `eglGetPlatformDisplay()` and `eglGetPlatformDisplayEXT()`.
- Fixed EGL's `Display::new()` making an `EGLDisplay::Khr` when the EGL version for the display is 1.4 or lower.

# Version 0.32.0

Expand Down
20 changes: 10 additions & 10 deletions glutin/src/api/egl/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,18 +487,18 @@ impl Display {

// Sanitize the display provider, as the received EGL 1.4 display could have
// been marked incorrectly as `EglDisplay::Khr`.
#[cfg(free_unix)]
// See pull request #1690.
let display = match display {
// Since according to libglvnd, `eglGetPlatformDisplay` and `GetPlatformDisplayEXT`
// aren't really differentiated under the hood, we must check if the version of the
// initialized display is not sensible for the EglDisplay type and downgrade it if so
// See: https://gitlab.freedesktop.org/glvnd/libglvnd/-/blob/606f6627cf481ee6dcb32387edc010c502cdf38b/src/EGL/libegl.c#L270-358
// https://gitlab.freedesktop.org/glvnd/libglvnd/-/blob/606f6627cf481ee6dcb32387edc010c502cdf38b/src/EGL/libegl.c#L409-461
// https://gitlab.freedesktop.org/glvnd/libglvnd/-/blob/606f6627cf481ee6dcb32387edc010c502cdf38b/include/glvnd/libeglabi.h#L231-232
// https://gitlab.freedesktop.org/glvnd/libglvnd/-/issues/251
EglDisplay::Khr(display) if version == Version { major: 1, minor: 4 } => {
// `eglGetPlatformDisplay` and `GetPlatformDisplayEXT` aren't really differentiated,
// we must check if the version of the initialized display is not sensible for the
// EglDisplay type and downgrade it if so.
EglDisplay::Khr(display) if version <= Version { major: 1, minor: 4 } => {
let client_extensions = CLIENT_EXTENSIONS.get().unwrap();
if client_extensions.contains("EGL_EXT_platform_base") {
if client_extensions.contains("EGL_EXT_platform_base")
&& (version == Version { major: 1, minor: 4 })
{
// `EGL_EXT_platform_base` requires EGL 1.4 per specification; we cannot safely
// presume that an `Ext` display would be valid for older versions.
EglDisplay::Ext(display)
} else {
EglDisplay::Legacy(display)
Expand Down

0 comments on commit cb7d8b0

Please sign in to comment.