The original code for immediate mode has always sought efficiency in
memory (for using glMapBufferRange) and performance for creating its
own memory management system, avoiding as much as possible calling
glBufferData (which respecifies the buffer).
But this ideal started to change when glBufferData started to be
called more often.
The commit rB5d9d24685108 caused glBufferData to be called almost
every time immBegin is called.
This makes the memory management entirely dependent on the GPU driver.
This patch follows some of the ideas covered in
https://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf
with respect to method Unsynchronized Buffers.
The idea is to create 3 buffers and alternate them in each frame.
So the buffer_offset can be reset every 3 frames.
The maximum amount of memory read in the frame is used for each buffer.
So we kind of allocate the minimum required memory used by Blender for
drawing with immediate mode.