Shader Learn

11 GPU quirks

Branches: the GPU runs pixels in groups

Neighbouring pixels run together as a group. In the yellow groups some pixels take the if and some the else — so both get computed.

0.050.45

Runs once per pixelDrag numbers, or edit the code

JS sidegl.uniform2f(uResolution, …, …) gl.uniform1f(uTime, 0.00)

The GPU runs pixels in groups. When a group disagrees on a condition, both branches run (divergence) — that is what the yellow groups show.

Try it

  • Make the groups bigger: more yellow
  • Make the radius small: almost every group agrees