Slow shader compilation

Hi All,

How can we speed-up shader compilation?

We need to compile 14 shaders (7 vertex + 7 fragment shaders) and takes some time.

Would string compression help in this case?

Thanks,

Alberto

See glGetProgramBinary for a way to cache compiled shaders.
Beyond that I think you’d have to get a job at the vendor that writes your drivers and work on optimizing their shader compiler :wink:
What does “takes some time” mean here, are we talking about tens of milliseconds or minutes? Is the compilation the bottleneck or is perhaps your file IO to load the shader source from disk slow?

I will send a resume to ATI.com Carsten :smiley:

By the way we see a small delay in loading the OpenGL viewport, about 1 second.

Yes, the bottleneck it the compilation of the 14 shaders source code.

carsten,

Is there any risk that the compiled shared will not work with all drivers out there?

Thanks,

Alberto

Yes there is. You have to test the program binary against the current driver.

How could we test all the driver on earth, Alfonse?

To me it looks like ‘craving for troubles’…

Look at the old extension. There is example code at the bottom
http://www.opengl.org/registry/specs/ARB/get_program_binary.txt

They use this line to test against all the drivers

glGetProgramiv(progObj, GL_LINK_STATUS, &success);
if (!success)