Libraries Loaded On-Demand

On supported systems, these libraries are only loaded when needed to compile shader programs at runtime:

libnvidia-glcore-cg.so.<version>
libnvidia-glcore-ocg.so.<version>

If all of the program binaries used by the application are precompiled, the OpenGL ES driver does not invoke the compiler, and the libraries are not loaded. Also, if the system supports the shader disk cache and the required shaders are found there (usually after the first time the application is run), the libraries are not loaded.

Note:

Systems supporting the on-demand loading of these libraries are the systems used with NVIDIA DRIVE Linux SDKand NVIDIA DRIVE QNX SDK. See the Release Notes for those releases for specific hardware and software information.

The -driverstate option allows for a small subset of GPU machine microcode to be inserted into the GL program binary via glProgramBinary. In very specific and limited cases, this option can prevent libnvidia-glcore-ocg.so from loading at runtime. GL may optimize machine code depending on the driver state, requiring a new machine code binary to be generated depending on certain states of the driver for each draw call.

A different -driverstate parameter must be specified for each draw call or glClear call. Multiple -driverstate commands can be input in a single GLSLC command line. The resulting microcode is appended to the same program binary file.

As an example, consider an application utilizing vertex attribute arrays that makes two draw calls, where the state of those arrays changes between each draw call. If attribute array 0 is enabled and attribute array 1 is disabled (constant attribute) during the first draw call, and both arrays are enabled during the second draw call, then the GLSLC command to obtain the program binary with optimized GPU machine code for both these states is similar to the following:

glslc -chip 10 -vs vs.vert -fs fs.frag
 -binary prog.bin -driverstate vertexattribenable 0 -driverstate
 vertexattribenable 0 vertexattribenable 1

The two -driverstate flags correspond to the state of the driver during each draw call, and there may be multiple vertexattribenable flags for each -driverstate usage.

A default set of machine code configurations are included if you use any -driverstate flags. Specify an empty -driverstate option followed by no state options if you require a set of default machine code configurations.

For example, the following produces a binary with a default set of machine code:

glslc -chip 10 -vs vert.vs -fs frag.fs 
-driverstate

You do not need an empty -driverstate option to include the defaults. The defaults are included if you use a -driverstate flag of any kind.

For example, the first -driverstate option below is redundant:

glslc -chip 10 -vs vert.vs -fs frag.fs 
-driverstate -driverstate vertexattribenable 0

The following is all that is needed:

glslc -chip 10 -vs vert.vs -fs frag.fs 
-driverstate vertexattribenable 0
Note:

The available options are currently limited to vertex and fragment shaders with a limited subset of options for producing the machine code. If the required microcode is not a part of the program binary during runtime, then the libnvidia-glcore-ocg.so library is loaded to perform runtime compilation.