Having this said, I can't figure out a good way to handle shader parameters that exist in more than one shader but are different in its type. For instance lets say i have a single shader effect which combines a vertex shader which has an parameter "Color" as a vector3 and a pixel shader which also has a parameter "Color" but as a vector4.
The problem is, it would be nice to set the parameters by using a parameter name, but what should i do in case of the example above?
The solutions that came into my mind are the following:
- Do not allow a combination of shaders where shader parameters conflict (kind of unflexible)
- Ignore shader parameter conflicts and just set the bytes that fit into the parameter / are provided by the application (maybe results in hard to find errors)
- Set the parameters per shader and not for the whole shader effect (uncomfortable)
Personally I am not a big fan of any of these solutions, but i think (1) and (2) could be ok. Setting the parameters for every single shader (3) feels a little bit too tiring and uncomfortable.
I am interested in how you handled this problem in your code. Are there any good solutions i have not thought of?
Thanks for your help!