View Full Version : Glslang & Linking

07-31-2003, 10:32 PM
From the specs on glslang, I can see that it is possible to, say, bind 2 vertex shaders to a program and compile them together such that vertex shader #1 can call functions in #2 and vice versa. However, there doesn't seem to be any specification on precisely how this works.

If I have Function1 defined in Shader1, and Function2 in Shader2, what do I need to do to allow Shader2 to access Function1 and vice-versa?

07-31-2003, 10:49 PM
from the spec, all used function have to be declared. the weird thing is that #include preprocessor directives are not allowed.
so, in order to organize your shaders, you have to load a shader "header" and append to it the shaders functions sources and then append the main shader function.
am I right ?

07-31-2003, 11:02 PM
What driver are you using? the 3dlabs compiler doenst work with functioncalls yet, atleast thats the answer i got from them on their forum.

07-31-2003, 11:22 PM
A shader must have a main() function. You can't succesfully link a shader with more than one main() (or none). That would nail down the execution. As for the prototype thing, I need to have another look ...