Floating Point Precision Test

Floating Point Precision Test for mobile GPUs

Created by marcogomez on Thu, 04 Nov 2021 21:03:31 GMT.


precision highp float;
uniform vec2 resolution;

void main(void) {
  float y = (gl_FragCoord.y / resolution.y) * 26.0;
  float x = 1.0 - (gl_FragCoord.x / resolution.x);
  float b = fract(pow(abs(2.0), floor(y)) + x); // abs(2.0) may prevent compilation warnings in Angle transpile
  if(fract(y) >= 0.9) { b = 0.0; }
  gl_FragColor = vec4(b, b, b, 1.0 );
}