Compiled GLSL shaders

Started by
3 comments, last by _the_phantom_ 19 years, 7 months ago
How can I compile GLSL shaders and then save them into file?
Advertisement
Short answer: You can't.
Long answer: You can't compile GLSL, because it's done inside the driver and the output will be depend on a specific GPU architecture. So if it would be possible, the compiled code would only run on your GPU.
Ok. How many program objects can I create with glCreateProgramObjectARB? Can I compile many different shaders and then install with glUseProgramObjectARB?
Quote:
Long answer: You can't compile GLSL, because it's done inside the driver and the output will be depend on a specific GPU architecture. So if it would be possible, the compiled code would only run on your GPU.


You technically might be able to compile it and get the results through the 3DLabs offline compiler, the problem might be as you referred, it's specifically optimized for the GPU that compiled it.
Even Longer Answer;
Nvidia do allow you to get back the compiled GLSL shader via a call specific to their drivers. However this is for debugging only as the code is potentially optermised specifical for the card that was in the system it was compiled for. While it might potentialy be able to be loaded back via the ARB assembler interface again I wouldnt count on it working (certainly on ATI hardware) or providing acceptable results even on NV hardware.
I say again debug ONLY.

As for the number of program objects, well I guess in theory you could create as many as you want, there might be an ARB_MAX_PROGRAMS varible, but I dont see it as being likely.

This topic is closed to new replies.

Advertisement