Hi there,
So I have been building a material / shader system which will allow me to compile permutations depending on a shaders options.
When you create a material, you provide it with:
- A Shader Path
- A list of defines that it uses
- A list of passes
- texture paths
- Material specific uniforms
- State (backface culling)
- Custom flags
Now when rendering, I get a bitmask for the options defined in the material; to get the premutation that supports the materials features.
This all works pretty well, but I am having some issues with Uniforms (where to add them etc)...
How do you guys handle uniforms when supporting multiple permutations of a shader?
Do you store the uniform locations for each permutation? Or some other method I haven't thought of?
(Using OpenGL 3.3+ as the basis
but will be adding support for 4.5 to get access to compute etc in the future)
Also if anyone knows of a good implementation that I could look at (for additional ideas), please let me know :)
Thanks