Some time ago we wrote about very strange problem, causing a driver to stall for some dramatic time, when FP uniforms are changed (or set for the very 1st time) and some geometry were drawn, but not even a bit of comments were got, except for other people complained about pretty the same problem and the official advice to pre-render everything (which is not fairly well in most cases).
But the problem were found and localized - nVidia drivers don’t like exact numbers like ±0.0f, ±0.5f and ±1.0f in FP uniform constant!!! Changing even a bit of mantissa of these “magic” values fixes almost all our problems. To all appearances, taking into consideration FP uniforms “constant” nature, driver thinks that it can improve this shader in order to make it much more fast and powerful (sic), and it creates unique shader realisation for this FP uniform value sub-set!
So please bear in mind, that some optimizations may be wanted to take place right in the middle of your application’s execution.
Hope, that helps someone, who wrecked not a single week to localize, why sometimes lags take places.