GL 3.2 came out yesterday, and also in the past few days the extensions
which is a way to mix and match shaders, however, it has a few issues:
1) uses gl_TexCoord, this is mostly cosmetic issue but force one to use compatible contexts.
2) issues on setting the interpolation type, i.e. flat, centroid, etc.
3) issues for fragment shader with respect to multiple render targets (see issue 16 of the spec of GL_EXT_separate_shader_objects).
But it is really, really close to being what I want, below is my suggestion for a slightly tweaked version of it which I *hope* addresses its shortcomings and for the driver writes not so nasty to implement:
In GLSL introduce a way to specify what resource an in or out variable of a shader is to be bound to (i.e. linker no longer decides), lets be lazy and use layout (maybe pragma would be better or a new keyword?)
would declare that the input variable myinput is using the N'th location, so in a vertex shader that specifies the index of the attribute, in a fragment shader that specifies the index of the interpolator (essentially gl_TexCoord[N]), andCode :layout(location, N) in vec4 myinput;
Code :layout(location, N) out vec4 myoutput;
would be similar, i.e. for vertex shader which interpolator (i.e. essentially gl_TexCoord[N]), for fragment shader which buffer to draw to, etc.
By doing it this way, atleast from a syntax point of view, it is easy to add the interpolation qualifiers for fragment inputs:
Code :layout(location,N) in vec4 flat flatFragInput;
and different types:
Code :layout(location,N) out ivec4 fragIntOutput;