Updated texture memory management code to eliminate inter-frame texture swapping and glFinish() calls, favouring performance over maximum texture resolution when memory is insufficient for textures at full resolution.

--HG--
extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%40159
This commit is contained in:
kearwood
2012-11-17 00:15:52 +00:00
parent c30c9725e9
commit a0549b4cfb
23 changed files with 406 additions and 180 deletions

View File

@@ -124,9 +124,9 @@ void KRModelManager::bindVBO(GLvoid *data, GLsizeiptr size, bool enable_vertex,
configureAttribs(enable_vertex, enable_normal, enable_tangent, enable_uva, enable_uvb);
#endif
} else {
m_vboMemUsed += size;
while(m_vbosPool.size() + m_vbosActive.size() >= KRContext::KRENGINE_MAX_VBO_HANDLES || m_vboMemUsed >= KRContext::KRENGINE_MAX_VBO_MEM) {
while(m_vbosPool.size() + m_vbosActive.size() + 1 >= KRContext::KRENGINE_MAX_VBO_HANDLES || m_vboMemUsed + size >= KRContext::KRENGINE_MAX_VBO_MEM) {
if(m_vbosPool.empty()) {
fprintf(stderr, "flushBuffers due to VBO exhaustion...\n");
m_pContext->rotateBuffers(false);
@@ -152,6 +152,7 @@ void KRModelManager::bindVBO(GLvoid *data, GLsizeiptr size, bool enable_vertex,
GLDEBUG(glBindBuffer(GL_ARRAY_BUFFER, m_currentVBO.vbo_handle));
GLDEBUG(glBufferData(GL_ARRAY_BUFFER, size, data, GL_STATIC_DRAW));
m_vboMemUsed += size;
configureAttribs(enable_vertex, enable_normal, enable_tangent, enable_uva, enable_uvb);
m_currentVBO.size = size;