4 Replies Latest reply on Feb 25, 2013 9:05 AM by tramboi

    Is it true that I can't glShaderBinary in OpenGL 4.2 on recent hardware?

    tramboi

      Hello, everybody.

      getting GL_NUM_SHADER_BINARY_FORMATS gives me 0 supported binary formats on my HD7900.

      Is it normal?  GL_NUM_SHADER_BINARY_FORMATS is 1, though.

      But I make heavy use of generating GLSL, compiling it and linking the objects with a potential very big combinatory...

      Can somebody confirm this?

        • Re: Is it true that I can't glShaderBinary in OpenGL 4.2 on recent hardware?
          gsellers

          Hi,

           

          GL_NUM_SHADER_BINARY_FORMATS is part of the GL_ARB_ES2_compatibility extension, which is designed to improve source-level portability from OpenGL-ES 2.0. This is the number of binary formats supported for shader binaries. However, it's not mandatory for any driver (even in OpenGL-ES 2.0) to support any binary formats for shaders at all and so it may return zero in this case.

           

          If you are running on desktop OpenGL, it's best to use program binaries as opposed to shader binaries. This allows you to get the binary for a fully linked monolithic program object. It works the same way as OpenGL-ES's shader binaries, except that you query GL_NUM_PROGRAM_BINARY_FORMATS and use glGetProgramBinary/glProgramBinary to retrieve and set the binary for the whole program object. This should work on any recent AMD driver.

           

          Cheers,

           

          Graham