Multiple shader effects on SGX

If multiple shader effects are to be supported on SGX, what is the best way to achieve this without compromising performance:

1 - Implement each effect as separate shader and switch between the shaders at run time by attaching/detaching with program object or rather switching between program objects at run time
2 - Implement all the effects as one combined shader and enable/disable desired effects via uniforms

What is the best option to work with as far as the performance on the PowerVR SGX is concerned keeping in mind its tile based rendering architecture? Thanks.

- J R Shah

This depends on your particular use case, but on the whole we would recommend the use of multiple small shaders with the number of changes between them minimised.





That said, it is possible that many changes of shader program during a render might be slower than a conditional in a single shader, but I would suggest trying the other approach first.