VertexBuffer/SpriteBatch speed tweaks.

- VertexBuffer holds permanent copy of the vertex data and is only read from
  GPU memory was written outside a sb:bind()/sb:unbind() pair.

- "Orphan" the current GPU buffer on unmap() before uploading the changed data
  to the GPU to avoid implicit synchronisation lags.
This commit is contained in:
vrld
2012-11-22 20:59:47 +01:00
parent 4de936ed75
commit 6ffb9d28f0
2 changed files with 53 additions and 42 deletions
+10 -5
View File
@@ -320,12 +320,17 @@ private:
// The VBO identifier. Assigned by OpenGL.
GLuint vbo;
// *May* contain data saved by 'unload'.
char *buffer_copy;
// A pointer to mapped memory. Will be inialized on the first
// call to map().
void *memory_map;
// A pointer to mapped memory. Zero if memory is currently
// not mapped.
void *mapped;
// Set if the vbo currently operates on main instead of gpu
// memory.
bool is_mapped;
// Set if the buffer was modified while operating on gpu memory
// and needs to be synchronized.
bool is_dirty;
// Usage hint for map()/unmap() pair. Same as `access' parameter in
// glBufferData or 0 if not mapped.