PDA

View Full Version : GLslang: no reuse of shader objects in other program objects?



Ostsol
12-29-2003, 10:44 PM
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?

dorbie
12-29-2003, 11:22 PM
I'm moving this thread to the shaders forum.

Corrail
12-30-2003, 06:00 AM
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.

mrbill
12-30-2003, 08:45 AM
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

Ostsol
12-30-2003, 10:49 AM
Originally posted by mrbill:
Did you successfully create the shader object(s)?

Did you successfully compile the shader object(s)?
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!