Forgive me, because I know this question has been asked before several times, but I've come across several different answers. Some people have claimed that drivers don't do duplicate state changes, others claim that they do.
It would make sense for a driver to use kind of a lazy evaluation approach imho. Keep track of the state changes and only update the state when you actually have to render something.
Suppose I was frequently changing the following states:
-texture enables 2D, RECT
-blend modes
-vertex array enables
-enables for blending, lighting, two sided lighting, cull face setting, line smooth, fill mode... etc
Would it be better for my wrapper:
1) to check each state to see if has changed and only call glEnable() on the changed ones, *or*
2) is it more efficient to do things brute force and just set them all?
I've heard there is a large overhead with changing the first state and then any other states that you change at the same time incur only a small performance penalty. (this is the reason for DX state blocks)
Is it worth it (performance wise) to write a wrapper around my commonly changed OpenGL states so as to not to set the same state twice... or do most drivers already check for this as an optimization?
I realize this whole question is pretty implementation dependent... ATI and Nvidia could do 2 separate things.



