mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
Switch to using glow as the default renderer both on native and the web (#1020)
* Switch to using glow as the default renderer both on native and the web * Simplify code to find WebGL context for glow * egui_web: make webgl an opt-in feature * Stop using deprecated WEBGL_debug_renderer_info
This commit is contained in:
@@ -19,7 +19,10 @@ pub mod backend;
|
||||
mod glow_wrapping;
|
||||
mod painter;
|
||||
pub mod screen_reader;
|
||||
|
||||
#[cfg(feature = "webgl")]
|
||||
pub mod webgl1;
|
||||
#[cfg(feature = "webgl")]
|
||||
pub mod webgl2;
|
||||
|
||||
pub use backend::*;
|
||||
@@ -1234,3 +1237,23 @@ fn move_text_cursor(cursor: &Option<egui::Pos2>, canvas_id: &str) -> Option<()>
|
||||
style.set_property("left", "0px").ok()
|
||||
}
|
||||
}
|
||||
|
||||
/// detecting Safari and webkitGTK.
|
||||
///
|
||||
/// Safari and webkitGTK use unmasked renderer :Apple GPU
|
||||
///
|
||||
/// If we detect safari or webkitGTK returns true.
|
||||
///
|
||||
/// This function used to avoid displaying linear color with `sRGB` supported systems.
|
||||
pub(crate) fn is_safari_and_webkit_gtk(gl: &web_sys::WebGlRenderingContext) -> bool {
|
||||
if let Ok(renderer) = gl.get_parameter(web_sys::WebglDebugRendererInfo::UNMASKED_RENDERER_WEBGL)
|
||||
{
|
||||
if let Some(renderer) = renderer.as_string() {
|
||||
if renderer.contains("Apple") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user