mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-25 16:42:26 +00:00
677a3f2f88
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
14 lines
249 B
GLSL
14 lines
249 B
GLSL
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
precision highp float;
|
|
#else
|
|
precision mediump float;
|
|
#endif
|
|
|
|
varying vec2 v_texcoord;
|
|
uniform sampler2D tex;
|
|
uniform float alpha;
|
|
|
|
void main() {
|
|
gl_FragColor = vec4(texture2D(tex, v_texcoord).rgb, 1.0) * alpha;
|
|
}
|