ARB_fp questions

I’ve got some questions concerning glProgramStringARB and glBindProgramARB. What does the OpenGL driver exactly do, when a new program is loaded or bound. Of cource the source is tokenized and parsed, but there are also some optimizations done. I’ve got an ATI card and looking at the native instruction count, it seems that the driver removes unnecessarily moves and other instructions if the result is never used. The combination of an vp/fp seems to be optimized together. Wenn I write to a texcoord and don’t read its value in the fp, the calculations seems to be removed from the vp. Does the NVIDIA OpenGL driver also these kinds of optimizations and what is happening exactly? How fast are glProgramStringARB and glBindProgramARB(in terms of complexity) ?
When rendering multiple passes, some parts of a shader are needed in every pass and some are only relevant in one pass. Is it possible to use just one shader for all passes, with just line changed that assigns result.color, and to hope that the driver will remove the unnecessary code?
It is further possible to use one master vp, that calculates all attributes like texcoord, lightvector, viewvector and let the driver optimize it in the case where the fp doesn’t need all these interpolated values?
Of course the obvious way is to optimize it all in the application, but it seems that the driver does already these optimizations and so my code can be simpler. But can I rely on this behaviour at least on standard hw?
Thanks.

yes the nvidia drivers will remove unuysed stuff as well.

When rendering multiple passes, some parts of a shader are needed in every pass and some are only relevant in one pass. Is it possible to use just one shader for all passes, with just line changed that assigns result.color, and to hope that the driver will remove the unnecessary code?
an ubershader,
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=11;t=000456

edit just saw the topic title, sorry i assumed you were talking about glsl

Well ,you can, but you shouldn’t… This is wrong attitude :slight_smile:

Use conditional compiling.