Can glShaderSource be called to update shader source code after shader compilation fail?

Viewed 47

I am currently writing a Shader class, and was curious whether following use case in opengl is valid.

Suppose you added source code (SourceCode) to a shader (specified by handle):

void glShaderSource(handle, 1, sourceCode, nullptr);

Then you try to compile the shader and it fails.

Is it a valid and/or well tested use case to update sourceCode, call glShaderSource again as above, and recompile?

1 Answers

Sure, you can compile other shaders after one failed.

well tested use case

I'm sure it's tested, but nobody does this. Fix your shader before you even start your program, not after.

Related