GLSL Gotchas
Here are some gotchas to be aware of when working with GLSL on various platforms.
Mac OSX
- Array declaration is broken on Snow Leopard (1)
Android, iOS, WebGL
- Specify precision where possible. Low precision is useful for colors (0.0 - 1.0). More info here.
- Be mindful of
step()as it may create branching (although it really shouldn't). Benchmark withsmoothstep()to see if performance improves. - 'For' loops may cause problems on certain Android devices (1)
- On WebGL, you don't need
#ifdef GL_ESas it will always return true - Many more optimizations listed here