Skip to content

render/gles2: default to highp if available

Simon Ser requested to merge emersion/wlroots:gles2-shader-precision into master

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.

I've considered de-duplicating the precision preamble, but this is non-trivial: the preamble needs to be after any #extension statement, but before the rest of the shader. Let's wait until !3805 to do that.

Merge request reports