Lifetime of glTransformFeedbackVaryings

What is the “lifetime” of this command? Does it affect only the next link or does it affect subsequent links until it’s called again for same shader program?

According to doc: “The state set by glTranformFeedbackVaryings is stored and takes effect next time glLinkProgram is called on program.” But is this state cleaned after linking?

Thanks

By all rights, you should only be linking a program once. It’s really bad form to link a program multiple times; just create a new program object and be done with it.

That being said, it should affect subsequent linkings after that call. The spec says nothing about the state set by glTransformFeedbackVaryings going away or being neutralized after link. So the state remains set.

Again: DO NOT RELY ON THIS! If you need a new program, make a new program.

What if I need only to reflect some changes to program, like new shader object being attached? I would prefer just attaching it and linking anew, not creating whole new program and making all the changes again.

What if I need only to reflect some changes to program, like new shader object being attached? I would prefer just attaching it and linking anew, not creating whole new program and making all the changes again.

Again, the general way most people do it is that they create a new program. They usually have some function that sets up their program, attributes if any, transform-feedback outputs if any, etc.

I would suggest thinking of programs as immutable (outside of uniform state) after linking.

No, you don’t have to. You can do whatever you want after linking. However, if you want your program to work, I would strongly suggest staying on the path most people use. And most people don’t reuse program objects; if they need to set up a new program with different shaders, they create a new program with different shaders. You are more likely to run into driver bugs if you reuse programs than if you don’t.

There’s a difference between “what the API allows” and “what it is a good idea to use.” The API will retain your transform feedback state if you need to re-link. It is not a good idea to re-link a program, however.

Okay got it, it won’t be a big deal to change anyway and in the end it actually makes everything easier, I just wanted to know if this is related only to Transform Feedback or basically everything to do with shader program…

Thanks

You should rather use separate programs (ARB_separate_shader_objects) and then you can mix-and-match your vertex/fragment shaders.

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