openglglslgpunvidia

Can't load GLSL shaders from binary on NVIDIA GRID GPU


I am using binary shaders in an OpenGL program. I compile those once on a single machine (Linux or Windows). Then I use it on other machines to run the app. Until now it worked fine on Nvidia GeForce 6x, Quadro, and K series Quadro. Now, trying it on Nvidia Tesla or GRID, it throws:

Program binary could not be loaded. Binary is not compatible with current driver/hardware combination.Error:1005

Tesla GPUs are pretty old so I could assume the hardware lacks this feature. But how come Nvidia GRID GPUs don't support this feature? I have latest drivers (319.72) installed with OpenGL 4.3.

Tesla and GRID use Ubuntu 12.04


Solution

  • This is not a hardware feature per-se. The compiled binary is architecture and driver version specific. Generally, you are not supposed to use binary shaders for anything more than caching shaders locally. Even on the same machine, from one driver version to another you are not guaranteed that the compiled binary will work.

    The extension that you linked to even mentions this:

    Loading a program binary may also fail if the implementation determines that there has been a change in hardware or software configuration from when the program binary was produced such as having been compiled with an incompatible or outdated version of the compiler. In this case the application should fall back to providing the original OpenGL Shading Language source shaders, and perhaps again retrieve the program binary for future use.

    You are free to ship your software with pre-compiled binary shaders, but be aware that since OpenGL does not define a standard binary format that they will likely only work with a specific GPU architecture and driver version. This works well for some fixed-spec. systems, but generally for portability you need to provide a fallback in the form of the original shader source code. This relegates binary GLSL programs mostly to caching, and not portable distribution.

    HLSL shaders can be distributed in binary form because Microsoft has a standard bytecode format and drivers translate this into the GPU's native instruction set. Unfortunately, OpenGL has no such equivalent. Individual vendors are allowed to extend the binary program system and define multiple binary formats (see the implementation-defined limit: GL_NUM_PROGRAM_BINARY_FORMATS for more details), some of which may be more portable than others, but binary GLSL programs are not required to work on any hardware/software configuration other than the one they were compiled/linked on.