mono/MonoGame — pull request #2123 by sulix (2013-11-10 12:05:27+00:00)
Title: Cache whether or not a VBO is bound when using GL

Reduces number of redundant glBindBuffer() calls when using DrawUser*Primitives several times in a row.

Basically, at the moment, every DrawUser*Primatives call (with the GL backend) starts by calling glBindBuffer() a couple of times to bind the null buffer as both a vertex and element (index) buffer. This patch basically caches whether or not the last draw operation was from a User pointer, and so the glBindBuffer calls only happen on the first DrawUser*Primatives call after a non-user-pointer call.

The actual performance improvement here is pretty small, but it sure makes digging through traces in apitrace more pleasent.

NB: It would be possible to cache whether or not vertex and index buffers are bound separately, but I doubt it's worth it.

— David