mediump float
in GLES shaders is supposed to be enough for texture coordinates, but is it enough for screen coordinates?
According to the this answer, mediump float
has a good amount of range - from -16384
to +16384
, however the precision is only 10 bit, which means that above +1024
or below -1024
, the float variable can be incremented only two pixels at a time, if I understand it correctly, so you will get pixel errors and seams between textures near screen edges.
With modern phones going up to 3840x2160
in display resolution, it looks like mediump is not enough for specifying pixel-perfect screen coordinates in the vertex shader.
I guess 1920x1080
screens are still kind of okay, if you use the middle of the screen as your zero coordinate, and not the top-left or bottom-left corner, and be careful about arithmetical operations you are performing on these variables to never exceed their safe -1024:+1024
range.
The phone manufacturers also could increase the floating point precision in their GFX hardware above the spec, to match their bigger screens, but I doubt they will.
Can someone please confirm this?