OpenGL:将着色器附加到处于有效链接状态的程序是否合法?

OpenGL: is it legal to attach a shader to a program that is in a valid linked state?

我已经搜索了对此的明确答案,但无济于事。 OpenGL 规范似乎对此保持沉默,但这可能是由于我没有阅读它们的经验。 我不关心实现如何处理这个问题。 谢谢。

来自here

While a program object is in use, applications are free to modify attached shader objects, compile attached shader objects, attach additional shader objects, and detach or delete shader objects. None of these operations will affect the executables that are part of the current state. However, relinking the program object that is currently in use will install the program object as part of the current rendering state if the link operation was successful...

所以是的,它是合法的,并且在您重新链接程序之前它不会生效。

并重新链接当前程序自动安装新版本。