This one has been bugging me for a while now. In the GL_ARB_shader_objects spec, under 2.14.2 Program Objects, it says
It is permissible to attach multiple shader objects of the same type to a single program object, and it is permissible to attach a shader object to more than one program object.
The latter half of this is fine (sharing vertex/fragment shaders across multiple programs).
The former half, though, has got me exercising those little grey cells. So I think I must be missing something fundamental.
Why would you want to attach two (or more) vertex/fragment shaders to a program object? What purpose does this achieve?
Are they run on each vertex/fragment in the order in which they are attached?
Is it for having "combo" effects, such that you don't have to write specialist shaders for each combination; instead just attach different effects?
What are the performance implications of doing so?
If anyone can shed any light on this, it'd be appreciated.