Merge pull request #2478 from degasus/fix_prefetching

HiresTexture: Fix prefetching with broken textures
This commit is contained in:
Ryan Houdek 2015-05-29 01:42:48 -04:00
commit cdbdff436b
1 changed files with 11 additions and 5 deletions

View File

@ -190,16 +190,22 @@ 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)
{
std::shared_ptr<HiresTexture> ptr(t);
iter = s_textureCache.insert(iter, std::make_pair(base_filename, ptr)); iter = s_textureCache.insert(iter, std::make_pair(base_filename, ptr));
} }
}
if (iter != s_textureCache.end())
{
for (const Level& l : iter->second->m_levels) for (const Level& l : iter->second->m_levels)
{ {
size_sum += l.data_size; size_sum += l.data_size;
} }
} }
}
if (s_textureCacheAbortLoading.IsSet()) if (s_textureCacheAbortLoading.IsSet())
{ {