Are binary OpenGL formats standardized?

I searched for binary OpenGL formats and what they really / mean. So far, I have not had much success. I know that I can get the number and set of formats as follows:

::glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, &values[0]); 

where the values ​​are std :: vector integers of size:

 ::glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &value); 

For the driver on my computer, one binary format is returned. It’s just a number and for me it’s completely pointless.

So my questions are these:

(1) What do format numbers / codes mean? (2) Are there standard ARB binary formats, or are they all vendor-specific? (3) Is there a common format between suppliers? (4) If there are several formats, how should you choose between them?

I have a vague feeling that I must first compile and cache the shaders on this machine in order to take advantage of this. I mean, this is not like DX, where you can run the shader compiler as an event after assembly and pack them together and use them on any (Windows) machine with D3D.

+7
source share
1 answer

(1) What do format numbers / codes mean?

They are unique identifiers.

(2) Are there standard ARB binary formats, or are they all vendor-specific?

All are supplier specific.

(3) Is there a common format between suppliers?

Not.

(4) If there are several formats, how should you choose between them?

Not. You have no choice of formats. When you call glGetProgramBinary , you get binary data in a specific format defined by the driver. When you download this program later , you must pass this particular binary data format.

I have a vague feeling that I must first compile and cache the shaders on a given machine in order to take advantage of this.

Yes, the purpose of this function is to enable cache shader compilation. But you should always make sure that your program will work if the version of the driver shader changes (and therefore differs from when you created the cached version). Thus, you still have to restore the shaders from the text form.

+11
source

All Articles