A program object that is successfully linked BUT has it's shaders detached can not be queried about it's binary - glGetProgramiv(prog, GL_PROGRAM_BINARY_LENGTH, &v) gives 0. Otherwise the program object works for rendering.
If the shaders are kept attached, then all works - the program obj is usable for rendering and the binary is retrievable.
This is a bug because, except for the linking, the attached shaders (or their lack thereof) should have no other effects on the program object. In particular they should not affect the binary.
I attached some simplified win32-based code that shows the bug.
Yeah, this looks like a bug on our side too. Another workaround appears to be setting the binary retriveable hint to true with glProgramParameteri(prog, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE) before linking, which is recommended anyway. We'll go see if we can fix it to do something reasonable even if the hint is false.
Thank you for the reply!
But I do call glProgramParameteri(prog, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE) before the linking (see the attached source) and still glGetProgramiv(prog, GL_PROGRAM_BINARY_LENGTH, &v) gives 0 after the shaders are detached
I also call glProgramParameteri(prog, GL_PROGRAM_SEPARABLE, GL_TRUE), but this is not important. The bug happens with normal (non-separable) program objects too. I have tested the standard case where the program object is not separable and has one vertex- and one fragment shader - the bug persists.