Shader link error C1002 from Nvidia driver

My fragment shader has a bunch of shaders (one for each light, plus a main one) that are compiled separately and linked together. This setup makes sense to me, because if the light configuration changes, I usually don’t have to recompile all the shaders, just some of them. But with a certain Nvidia driver, I get an error,

error C1002: the name “ECPos3” is already defined

complaining about a varying variable that is used in more than one of the shaders.

Would it be safer, if a little less efficient, to just glob all the shader code together and compile it all at once? Or is there another workaround?

Apparently, you don’t save much by using your approach over just making a big shader for each case, as most of the work is done in the linking stage anyway.

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