How can I use GLSL ES shader binaries in my application?

How can I use GLSL ES shader binaries in my application?

The GLSL ES compilers we provide in the SDK are for performance analysis only and do not produce binaries.



If you want to use binary shaders in your application, there are two options:


  1. Use the OES_get_program_binary OGLES2 extension (http://www.khronos.org/registry/gles/extensions/OES/OES_get_program_binary.txt) to retrieve shaders that have been compiled online by the target device so they can be cached for later use. Doing so means an application can deploy shader source to all target PowerVR platforms, but can benefit from the lower initialisation overhead of using pre-compiled shaders once they’ve been compiled once and retrieved (which could be done on first launch of the application, or during installation etc). There is a Training Course in the SDK called BinaryShader that demonstrates the use of this extension.


  2. Compile shader binaries offline for the target device. The downside of this approach is that the compiled binaries are specific to a graphics core and driver revision, so they are not portable between all PowerVR platforms. The benefits of this approach are that the application does not have the overhead of compiling the shaders once online (as option 1. requires), and that shaders can be deployed to a platform without storing them in human readable text. In applications where the algorithms used in shaders are the main IP of a developer, managing binaries for different hardware and driver configurations is one way of protecting this IP.

    If you need an offline shader compiler for your target platform, you can download an appropriate offline compiler package from our Developer Support portal (you must login to the portal to access these packages)