Fixed mesh streaming bug that would cause the texture streamer to incorrectly estimate how much memory it has to fill, resulting in deadlocks. Symptoms include low mip level textures and / or assets that fail to load due to incorrect balance of texture and VBO memory utilization.

This commit is contained in:
2014-08-27 02:24:49 -07:00
parent a3a6e4af78
commit 9f84482ec3

View File

@@ -284,16 +284,16 @@ void KRMeshManager::balanceVBOMemory(long &memoryRemaining, long &memoryRemainin
std::sort(m_activeVBOs_streamer.begin(), m_activeVBOs_streamer.end(), std::greater<std::pair<float, KRVBOData *>>()); std::sort(m_activeVBOs_streamer.begin(), m_activeVBOs_streamer.end(), std::greater<std::pair<float, KRVBOData *>>());
for(auto vbo_itr = m_activeVBOs_streamer.begin(); memoryRemainingThisFrame > 0 && vbo_itr != m_activeVBOs_streamer.end(); vbo_itr++) { for(auto vbo_itr = m_activeVBOs_streamer.begin(); vbo_itr != m_activeVBOs_streamer.end(); vbo_itr++) {
KRVBOData *vbo_data = (*vbo_itr).second; KRVBOData *vbo_data = (*vbo_itr).second;
if(!vbo_data->isVBOLoaded()) {
long vbo_size = vbo_data->getSize(); long vbo_size = vbo_data->getSize();
if(!vbo_data->isVBOLoaded()) {
if(memoryRemainingThisFrame > vbo_size) { if(memoryRemainingThisFrame > vbo_size) {
vbo_data->load(); vbo_data->load();
memoryRemainingThisFrame -= vbo_size; memoryRemainingThisFrame -= vbo_size;
} }
memoryRemaining -= vbo_size;
} }
memoryRemaining -= vbo_size;
} }
glFinish(); glFinish();