GLslang: no reuse of shader objects in other program objects?

Based on the spec, there is an aspect of GLslang that I had hoped would be available: that is, linked a shader pair into a new program object when one or both of the pair has previously been linked. I had thought this might be good in order to maximize shader reuse. Unfortunately, it appears that if, for example, a vertex shader has been linked with a fragment shader in one program object, that same vertex shader cannot be linked with another fragment shader in a different program object. Might I be doing something wrong or is this simply impossible?

I’m moving this thread to the shaders forum.

Hello!

This should be no problem and I just tried it. It worked. Maybe it is a bug in your driver or you’re really doing something wrong.

Common things to look for:

Did you successfully create the shader object(s)?

Did you successfully compile the shader object(s)?

Did you successfully create the program object(s)? Did you successfully attach the shader object(s) to the program object(s)?

Finally, for each program object, make sure that the set of vertex shader objects attached has one and only one main entry point. Same thing with the set of fragment shader objects attached.

But you absolutely may attach a shader object to multiple program objects.

-mr. bill

Originally posted by mrbill:
[b]Did you successfully create the shader object(s)?

Did you successfully compile the shader object(s)?[/b]

Yes, I make sure to check for that and toss an exception with the compilation error log if it fails.

Did you successfully create the program object(s)? Did you successfully attach the shader object(s) to the program object(s)?

Ah. . . Ok, the problem was my shader loading functions. I keep lists of all the shader objects and shader program objects I create and check those lists before I create another object to see if it has already been created. The problem is that when I find an already created object, I haven’t been assigning its handle to the variable that I then pass into the program object.

Quite a relief that it now works! Thanks for the help!

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