Add `prefer_egl` debug option
Some systems have rendering issues when using GLX rather than EGL. While this is usually due to a driver bug, it is helpful to provide a workaround for this by allowing people to prefer EGL over GLX. This patch adds the new `debug.prefer_egl` option to provide this workaround. Closes #7056.
This commit is contained in:
parent
8d174429ee
commit
8eed17227a
|
@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Copy global IPC options (`-w -1`) for new windows
|
- Copy global IPC options (`-w -1`) for new windows
|
||||||
- Bindings to create and navigate tabs on macOS
|
- Bindings to create and navigate tabs on macOS
|
||||||
- Support startup notify protocol to raise initial window on Wayland/X11
|
- Support startup notify protocol to raise initial window on Wayland/X11
|
||||||
|
- Debug option `prefer_egl` to prioritize EGL over other display APIs
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@ pub struct Debug {
|
||||||
/// The renderer alacritty should be using.
|
/// The renderer alacritty should be using.
|
||||||
pub renderer: Option<RendererPreference>,
|
pub renderer: Option<RendererPreference>,
|
||||||
|
|
||||||
|
/// Use EGL as display API if the current platform allows it.
|
||||||
|
pub prefer_egl: bool,
|
||||||
|
|
||||||
/// Record ref test.
|
/// Record ref test.
|
||||||
#[config(skip)]
|
#[config(skip)]
|
||||||
pub ref_test: bool,
|
pub ref_test: bool,
|
||||||
|
@ -38,6 +41,7 @@ impl Default for Debug {
|
||||||
highlight_damage: Default::default(),
|
highlight_damage: Default::default(),
|
||||||
ref_test: Default::default(),
|
ref_test: Default::default(),
|
||||||
renderer: Default::default(),
|
renderer: Default::default(),
|
||||||
|
prefer_egl: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,15 +21,24 @@ use winit::window::raw_window_handle::{RawDisplayHandle, RawWindowHandle};
|
||||||
pub fn create_gl_display(
|
pub fn create_gl_display(
|
||||||
raw_display_handle: RawDisplayHandle,
|
raw_display_handle: RawDisplayHandle,
|
||||||
_raw_window_handle: Option<RawWindowHandle>,
|
_raw_window_handle: Option<RawWindowHandle>,
|
||||||
|
_prefer_egl: bool,
|
||||||
) -> GlutinResult<Display> {
|
) -> GlutinResult<Display> {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let preference = DisplayApiPreference::Cgl;
|
let preference = DisplayApiPreference::Cgl;
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
let preference = DisplayApiPreference::Wgl(Some(_raw_window_handle.unwrap()));
|
let preference = if _prefer_egl {
|
||||||
|
DisplayApiPreference::EglThenWgl(Some(_raw_window_handle.unwrap()))
|
||||||
|
} else {
|
||||||
|
DisplayApiPreference::WglThenEgl(Some(_raw_window_handle.unwrap()))
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
|
#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
|
||||||
let preference = DisplayApiPreference::GlxThenEgl(Box::new(x11::register_xlib_error_hook));
|
let preference = if _prefer_egl {
|
||||||
|
DisplayApiPreference::EglThenGlx(Box::new(x11::register_xlib_error_hook))
|
||||||
|
} else {
|
||||||
|
DisplayApiPreference::GlxThenEgl(Box::new(x11::register_xlib_error_hook))
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(all(not(feature = "x11"), not(any(target_os = "macos", windows))))]
|
#[cfg(all(not(feature = "x11"), not(any(target_os = "macos", windows))))]
|
||||||
let preference = DisplayApiPreference::Egl;
|
let preference = DisplayApiPreference::Egl;
|
||||||
|
|
|
@ -92,8 +92,11 @@ impl WindowContext {
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
let raw_window_handle = None;
|
let raw_window_handle = None;
|
||||||
|
|
||||||
let gl_display =
|
let gl_display = renderer::platform::create_gl_display(
|
||||||
renderer::platform::create_gl_display(raw_display_handle, raw_window_handle)?;
|
raw_display_handle,
|
||||||
|
raw_window_handle,
|
||||||
|
config.debug.prefer_egl,
|
||||||
|
)?;
|
||||||
let gl_config = renderer::platform::pick_gl_config(&gl_display, raw_window_handle)?;
|
let gl_config = renderer::platform::pick_gl_config(&gl_display, raw_window_handle)?;
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
|
|
|
@ -935,6 +935,13 @@ relied upon.
|
||||||
|
|
||||||
Default: _false_
|
Default: _false_
|
||||||
|
|
||||||
|
*prefer_egl* <boolean>
|
||||||
|
|
||||||
|
Use EGL as display API if the current platform allows it. Note that
|
||||||
|
transparency may not work with EGL on Linux/BSD.
|
||||||
|
|
||||||
|
Default: _false_
|
||||||
|
|
||||||
# SEE ALSO
|
# SEE ALSO
|
||||||
|
|
||||||
*alacritty*(1), *alacritty-msg*(1), *alacritty-bindings*(5)
|
*alacritty*(1), *alacritty-msg*(1), *alacritty-bindings*(5)
|
||||||
|
|
Loading…
Reference in New Issue