View Full Version : Problems in defining subroutines of a given type in different shader objects

05-04-2014, 07:36 AM
My question is: having several compute shaders compiled and linked into one program, is there a way how to define one subroutine type and define several subroutines of the type in any of the shader objects?

In particular, shall the setup which follows work regarding the specification ? :

shader A (where the main's method sits along with some Map subroutine's definitions )

subroutine vec4 Map(vec4 p);
subroutine uniform Map u_Map;
vec4 MapA1(vec4 p){..}

vec4 MapA2(vec4 p){..}

.. some Map subroutine usage through u_Map
void Main(){}

shader B (where auxiliary subroutines are defined)

vec4 MapB1(vec4 p){..}

vec4 MapB2(vec4 p){..}

On Linux platform with the current Nvidia drivers this doesn't work. It gives me error during compilation of the B with a message: C0000: syntax error, unexpected identifier, expecting "::" at token "Map"

I would be glad for any opinion on this, thanks in advance.