Skip to main content
gamedev.net
🔒 Locked

glGetProgramBinary - GL_PROGRAM_BINARY_LENGTH returns 0

Started by IronFox 1 reply 5.1k views
Original Post
IronFox
IronFox
Hi everybody,

I tried implementing the ARB_get_program_binary OpenGL functionality, but I seem to have run into a problem there. For a given GLSL shader program, that has successfuly been compiled and linked, I get a 0 from glGetProgramiv(...,GL_PROGRAM_BINARY_LENGTH,...).
The function itself does not fail, nor does it trigger any gl-errors. Subsequent attempts to retrieve the binary code by calling glGetProgramBinary(...), however, will fail with GL_INVALID_OPERATION, even though I passed a 1MB large data buffer.
I tripple checked that the extension is indeed available and I am working on correctly retrieved function pointers (that are not NULL). And yes, I did check that the program is linked correctly. I tried with and without glUseProgram(...) before retrieving the binary representation.

Any thoughts? Am I missing something?

I'm working on ATI here, so I guess there's a chance that it's a driver bug...
sprite_hound
sprite_hound
[font="Arial"]Have you tried adding glProgramParameteri(program, PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE); before linking the program?
[/font]
[font="Arial"]
[/font]
[font="Arial"]I'm not sure if this is required before retrieving the binary, or just optional... (the extension spec kinda hints at the latter, but it's pretty unclear).[/font]
IronFox
IronFox

[font="Arial"]Have you tried adding glProgramParameteri(program, PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE); before linking the program?
[/font]

[font="Arial"]I'm not sure if this is required before retrieving the binary, or just optional... (the extension spec kinda hints at the latter, but it's pretty unclear).[/font]


Whaddaya know, that worked
Guess that answers that question. Many thanks!


Edit:
Yep, working nicely. It really makes quite the difference, if you have to load like 50 shaders...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.