HiresTexture: Fix prefetching with broken textures

This commit is contained in:
degasus 2015-05-29 07:31:11 +02:00
parent 6ff3fcee59
commit c69cc91f00
1 changed files with 11 additions and 5 deletions

View File

@ -190,14 +190,20 @@ void HiresTexture::Prefetch()
// But bad luck, SOIL isn't, so TODO: remove SOIL usage here and use libpng directly // But bad luck, SOIL isn't, so TODO: remove SOIL usage here and use libpng directly
// Also TODO: remove s_textureCacheAquireMutex afterwards. It won't be needed as the main mutex will be locked rarely // Also TODO: remove s_textureCacheAquireMutex afterwards. It won't be needed as the main mutex will be locked rarely
//lk.unlock(); //lk.unlock();
std::shared_ptr<HiresTexture> ptr(Load(base_filename, 0, 0)); HiresTexture* t = Load(base_filename, 0, 0);
//lk.lock(); //lk.lock();
if (t)
iter = s_textureCache.insert(iter, std::make_pair(base_filename, ptr)); {
std::shared_ptr<HiresTexture> ptr(t);
iter = s_textureCache.insert(iter, std::make_pair(base_filename, ptr));
}
} }
for (const Level& l : iter->second->m_levels) if (iter != s_textureCache.end())
{ {
size_sum += l.data_size; for (const Level& l : iter->second->m_levels)
{
size_sum += l.data_size;
}
} }
} }