Performance for building OpenGL ES and ANGLE shaders


Today's note is a simple reminder that if you're using OpenGL ES and/or ANGLE, you're not exempt from the performance concerns I've discussed before. Launching quickly is still important for user experience, and developers want to provide a good first impression!

The classic OpenGL ES model is to compile the shaders from text. There is also the option to use a precompiled shader binary. This is also true for ANGLE - the OES_get_program_binary extension is supported. More details are available on the Caching compiled binaries page.

Note however that this model doesn't work for offline compilation; the bytecode or binaries produced are not device independent. So the usage is to compile on first run, and be prepared to recompile if the binaries become invalid, for example because the user installs a new video card or a driver update requires binaries to be recompiled.

Some of things I described in Compiling shaders vs creating shaders should also be considered. How many shaders are you going to compile, when are you going to compile them, and what your saving/loading/lookup strategy should be. These will typically be tradeoffs between longer startup vs. compiling as you go, disk usage, and random vs. uniform access patterns.

Enjoy!

Comments (0)

Skip to main content