aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/renderer/platform.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-05-21 04:06:15 +0300
committerGitHub <noreply@github.com>2023-05-21 04:06:15 +0300
commit36301e4195148d6f3b60b75f8a30f7a08e8bf2a7 (patch)
tree0f02909e5f2db1c6035c984f2e11909222cf8072 /alacritty/src/renderer/platform.rs
parent6e7f466c68b387f41726757eed4f3e70d05479d2 (diff)
downloadr-alacritty-36301e4195148d6f3b60b75f8a30f7a08e8bf2a7.tar.gz
r-alacritty-36301e4195148d6f3b60b75f8a30f7a08e8bf2a7.tar.bz2
r-alacritty-36301e4195148d6f3b60b75f8a30f7a08e8bf2a7.zip
Improve renderer debuggability
Make the renderer more debuggable by adding extra logging and using `GL_KHR_debug` when running with the debug log level.
Diffstat (limited to 'alacritty/src/renderer/platform.rs')
-rw-r--r--alacritty/src/renderer/platform.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/alacritty/src/renderer/platform.rs b/alacritty/src/renderer/platform.rs
index c9802e0a..10c17cb7 100644
--- a/alacritty/src/renderer/platform.rs
+++ b/alacritty/src/renderer/platform.rs
@@ -10,6 +10,7 @@ use glutin::display::{Display, DisplayApiPreference, GetGlDisplay};
use glutin::error::Result as GlutinResult;
use glutin::prelude::*;
use glutin::surface::{Surface, SurfaceAttributesBuilder, WindowSurface};
+use log::{debug, LevelFilter};
use raw_window_handle::{RawDisplayHandle, RawWindowHandle};
use winit::dpi::PhysicalSize;
@@ -69,6 +70,24 @@ pub fn pick_gl_config(
};
if let Some(gl_config) = gl_config {
+ debug!(
+ r#"Picked GL Config:
+ buffer_type: {:?}
+ alpha_size: {}
+ num_samples: {}
+ hardware_accelerated: {:?}
+ supports_transparency: {:?}
+ config_api: {:?}
+ srgb_capable: {}"#,
+ gl_config.color_buffer_type(),
+ gl_config.alpha_size(),
+ gl_config.num_samples(),
+ gl_config.hardware_accelerated(),
+ gl_config.supports_transparency(),
+ gl_config.api(),
+ gl_config.srgb_capable(),
+ );
+
return Ok(gl_config);
}
}
@@ -81,15 +100,19 @@ pub fn create_gl_context(
gl_config: &Config,
raw_window_handle: Option<RawWindowHandle>,
) -> GlutinResult<NotCurrentContext> {
+ let debug = log::max_level() >= LevelFilter::Debug;
let mut profiles = [
ContextAttributesBuilder::new()
+ .with_debug(debug)
.with_context_api(ContextApi::OpenGl(Some(Version::new(3, 3))))
.build(raw_window_handle),
// Try gles before OpenGL 2.1 as it tends to be more stable.
ContextAttributesBuilder::new()
+ .with_debug(debug)
.with_context_api(ContextApi::Gles(Some(Version::new(2, 0))))
.build(raw_window_handle),
ContextAttributesBuilder::new()
+ .with_debug(debug)
.with_profile(GlProfile::Compatibility)
.with_context_api(ContextApi::OpenGl(Some(Version::new(2, 1))))
.build(raw_window_handle),