Problems in defining subroutines of a given type in different shader objects

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;
..
subroutine(Map)
vec4 MapA1(vec4 p){..}

subroutine(Map)
vec4 MapA2(vec4 p){..}

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

shader B (where auxiliary subroutines are defined)


subroutine(Map)
vec4 MapB1(vec4 p){..}

subroutine(Map)
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.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.