Shader Learn

11 GPU quirks

Precision: a float is not infinite

Add a big number to the coordinate, then take the fraction. Mathematically nothing changes; on the GPU it does.

07

Runs once per pixelDrag numbers, or edit the code

A float has only about 7 significant digits: add a small number to a big one and the fraction is lost. The longer a page is open, the bigger uTime gets.

Try it

  • Set the magnitude to 6: the sawtooth turns into steps
  • At 7 there is almost no gradient left
  • On phones, mediump often breaks at 3–4 already