mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
render/gles2: default to highp if available
The spec [1] says that the maximum value for a mediump float is at least 2¹⁴ in section 4.5.2. However, when using a 4k resolution texture coordinates will exceed this value. This causes issues on drivers which implement mediump as a 16-bit [2]. Switch to highp. There's a twist: on GLES2, support for highp is optional. So we need to guard it with cute GL_FRAGMENT_PRECISION_HIGH ifdefs. [1]: https://registry.khronos.org/OpenGL/specs/es/2.0/GLSL_ES_Specification_1.00.pdf [2]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21082
This commit is contained in:
parent
0534d12b28
commit
677a3f2f88
4 changed files with 20 additions and 0 deletions
|
@ -1,4 +1,9 @@
|
||||||
|
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||||
|
precision highp float;
|
||||||
|
#else
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
varying vec4 v_color;
|
varying vec4 v_color;
|
||||||
varying vec2 v_texcoord;
|
varying vec2 v_texcoord;
|
||||||
uniform vec4 color;
|
uniform vec4 color;
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
#extension GL_OES_EGL_image_external : require
|
#extension GL_OES_EGL_image_external : require
|
||||||
|
|
||||||
|
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||||
|
precision highp float;
|
||||||
|
#else
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
varying vec2 v_texcoord;
|
varying vec2 v_texcoord;
|
||||||
uniform samplerExternalOES texture0;
|
uniform samplerExternalOES texture0;
|
||||||
uniform float alpha;
|
uniform float alpha;
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
|
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||||
|
precision highp float;
|
||||||
|
#else
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
varying vec2 v_texcoord;
|
varying vec2 v_texcoord;
|
||||||
uniform sampler2D tex;
|
uniform sampler2D tex;
|
||||||
uniform float alpha;
|
uniform float alpha;
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
|
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||||
|
precision highp float;
|
||||||
|
#else
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
varying vec2 v_texcoord;
|
varying vec2 v_texcoord;
|
||||||
uniform sampler2D tex;
|
uniform sampler2D tex;
|
||||||
uniform float alpha;
|
uniform float alpha;
|
||||||
|
|
Loading…
Reference in a new issue