Actually, you can link several shaders together as long as there is only 1 main() function.
Also, there is the include feature now. It is an extension for now
http://www.opengl.or...age_include.txt
Ah ok, good to know. But i think it isnt availible on older cards (like mine radean hd 2600) isnt it?
Also #include is pretty straight-forward to implement on your own anyway. Since you are the ones writing the shaders, there is no reason a most-basic parser will not work.
I suggest going with uber shaders though. It is straight-forward and simple to implement.
You basically just associate one #ifdef with one bit flag in your code.
You ask for shaders from your shader manager (at the time of rendering) by sending bit flags that tell the manager what kind of shader you want (one with normal mapping, one without, etc.) and when it sees a given flag it sends the matching macro to the shader. Now you have permutations, and it was that simple.
The shader creation flags are remembered by the manager, so next time you ask for the same shader you will get the one that was already compiled.
Creating a shader preprocessor isnt as strength to me as you might think. I already build a 'compiler' for a scripting alguage with dynamic loaded syntax and
commands based on an ebnf pattern struct. I only have to change this a little, managing several includes ionto one file an well it is.
To had the idea with the flags too but in a different way. My engine only contains the main propertys per object (like only position and orientation of a mesh) and the other
propertys are modified by either there is an existing property (like color) so there is a filter object added, that modifies the property or it is a completly new ability (like a clipping function)
then there is a propperty handler added. Now im able to add a flag handler to a shader object that modifies some known flags or uniforms every time the shader is activated.