aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/renderer/platform.rs
diff options
context:
space:
mode:
authorRolf Sievert <26115145+RolfSievert@users.noreply.github.com>2023-09-04 22:15:46 +0200
committerGitHub <noreply@github.com>2023-09-04 20:15:46 +0000
commit8eed17227a2d1541c54abdb8498d69ba25ef0df6 (patch)
tree2286cea275dcca3b76f6dd6624c118b3b59571fb /alacritty/src/renderer/platform.rs
parent8d174429ee1e63e865a9203d7dfc4ce2cd25576d (diff)
downloadr-alacritty-8eed17227a2d1541c54abdb8498d69ba25ef0df6.tar.gz
r-alacritty-8eed17227a2d1541c54abdb8498d69ba25ef0df6.tar.bz2
r-alacritty-8eed17227a2d1541c54abdb8498d69ba25ef0df6.zip
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.
Diffstat (limited to 'alacritty/src/renderer/platform.rs')
-rw-r--r--alacritty/src/renderer/platform.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/alacritty/src/renderer/platform.rs b/alacritty/src/renderer/platform.rs
index 495e837e..b31e6974 100644
--- a/alacritty/src/renderer/platform.rs
+++ b/alacritty/src/renderer/platform.rs
@@ -21,15 +21,24 @@ use winit::window::raw_window_handle::{RawDisplayHandle, RawWindowHandle};
pub fn create_gl_display(
raw_display_handle: RawDisplayHandle,
_raw_window_handle: Option<RawWindowHandle>,
+ _prefer_egl: bool,
) -> GlutinResult<Display> {
#[cfg(target_os = "macos")]
let preference = DisplayApiPreference::Cgl;
#[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))))]
- 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))))]
let preference = DisplayApiPreference::Egl;