Platform code:
GLBuffer allocate_gl_buffer();
ShmBuffer allocate_shm_buffer(); // Should work on all platforms
Rendering code:
Switch behaviour based on the type of buffer. e.g. a ShmBuffer can be released immediately after glTexImage2D. However a GLBuffer must be held till after swapbuffers as the driver is likely sharing memory.
Generic buffer queuing code:
Can refer to them all as "Buffer" which is the base class of the things being queued.
In summary, I think we need:
Platform code: gl_buffer( ); shm_buffer( ); // Should work on all platforms
GLBuffer allocate_
ShmBuffer allocate_
Rendering code:
Switch behaviour based on the type of buffer. e.g. a ShmBuffer can be released immediately after glTexImage2D. However a GLBuffer must be held till after swapbuffers as the driver is likely sharing memory.
Generic buffer queuing code:
Can refer to them all as "Buffer" which is the base class of the things being queued.