My shaders often share much of the same functionality. For instance calculation of diffuse/specular lighting. I would like to write this one time and then reuse the code across different shaders.

Glsl has no knowledge of files, and no support for a c-like #include preprocessor directive.

I know glsl has support for compiling source from multiple cstrings, but how would you know which cstrings to include? Do you implement your own version of include? Or do you create some sort of metafile for each of your shaders?

Edit
Report