PowerVR documentation from Imagination says there’s static flow control. (7.9 Flow Contro)
What’s the static flow control? Does it mean compiler preprocessor like #if...#endif? And they’re saying,
Static flow control can be used to combine many shaders into one big shader.
and what does this mean? Can I instantiate many variants of shaders from one source?
As per the text earlier in 7.9:
So you’d have one shader that made a branch decision based on a uniform. That would be static flow control.
What they’re trying to tell you is that setting uniforms can dynamically reprogram shaders — the compiled code will be patched with the new uniform values rather than those values being looked up every time the shader runs. So the costs for accessing uniforms within a shader are the same as for using constants and the costs for setting uniforms outside the shader are probably greater than you’d guess.