diff --git a/crates/egui_glow/src/shader/fragment.glsl b/crates/egui_glow/src/shader/fragment.glsl index 30da2809ee4..f2792ed04aa 100644 --- a/crates/egui_glow/src/shader/fragment.glsl +++ b/crates/egui_glow/src/shader/fragment.glsl @@ -1,5 +1,11 @@ #ifdef GL_ES - precision mediump float; + // To avoid weird distortion issues when rendering text etc, we want highp if possible. + // But apparently some devices don't support it, so we have to check first. + #if defined(GL_FRAGMENT_PRECISION_HIGH) && GL_FRAGMENT_PRECISION_HIGH == 1 + precision highp float; + #else + precision mediump float; + #endif #endif uniform sampler2D u_sampler; diff --git a/crates/egui_glow/src/shader/vertex.glsl b/crates/egui_glow/src/shader/vertex.glsl index fff31463ceb..0c6e9d2314b 100644 --- a/crates/egui_glow/src/shader/vertex.glsl +++ b/crates/egui_glow/src/shader/vertex.glsl @@ -9,7 +9,13 @@ #endif #ifdef GL_ES - precision mediump float; + // To avoid weird distortion issues when rendering text etc, we want highp if possible. + // But apparently some devices don't support it, so we have to check first. + #if defined(GL_FRAGMENT_PRECISION_HIGH) && GL_FRAGMENT_PRECISION_HIGH == 1 + precision highp float; + #else + precision mediump float; + #endif #endif uniform vec2 u_screen_size;