Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/TextureManager.cpp
Show First 20 Lines • Show All 492 Lines • ▼ Show 20 Lines | |||||
if (!m_TextureConverter.ConvertTexture(texture, sourcePath, VfsPath("cache") / archiveCachePath, settings)) | if (!m_TextureConverter.ConvertTexture(texture, sourcePath, VfsPath("cache") / archiveCachePath, settings)) | ||||
return false; | return false; | ||||
while (true) | while (true) | ||||
{ | { | ||||
CTexturePtr textureOut; | CTexturePtr textureOut; | ||||
VfsPath dest; | VfsPath dest; | ||||
bool ok; | |||||
if (m_TextureConverter.Poll(textureOut, dest, ok)) | try | ||||
return ok; | { | ||||
if (m_TextureConverter.Poll(textureOut, dest)) | |||||
return true; | |||||
} | |||||
catch (ConversionError& e) | |||||
{ | |||||
return false; | |||||
} | |||||
std::this_thread::sleep_for(std::chrono::microseconds(1)); | std::this_thread::sleep_for(std::chrono::microseconds(1)); | ||||
} | } | ||||
} | } | ||||
VfsPath GetCachedPath(const VfsPath& path) const | VfsPath GetCachedPath(const VfsPath& path) const | ||||
{ | { | ||||
return m_CacheLoader.ArchiveCachePath(path); | return m_CacheLoader.ArchiveCachePath(path); | ||||
} | } | ||||
bool MakeProgress() | bool MakeProgress() | ||||
{ | { | ||||
// Process any completed conversion tasks | // Process any completed conversion tasks | ||||
{ | { | ||||
CTexturePtr texture; | CTexturePtr texture; | ||||
VfsPath dest; | VfsPath dest; | ||||
bool ok; | bool ok; | ||||
phosit: `ok` is useless now | |||||
if (m_TextureConverter.Poll(texture, dest, ok)) | try | ||||
{ | { | ||||
if (ok) | if (m_TextureConverter.Poll(texture, dest)) | ||||
{ | { | ||||
LoadTexture(texture, dest); | LoadTexture(texture, dest); | ||||
texture->m_State = CTexture::LOADED; | |||||
return true; | |||||
} | } | ||||
else | } | ||||
{ | catch (ConversionError& e) | ||||
LOGERROR("Texture failed to convert: \"%s\"", texture->m_Properties.m_Path.string8()); | { | ||||
texture->ResetBackendTexture( | LOGERROR("Texture failed to convert: \"%s\"", | ||||
nullptr, m_ErrorTexture.GetTexture()->GetBackendTexture()); | e.GetTexture()->m_Properties.m_Path.string8()); | ||||
} | e.GetTexture()->ResetBackendTexture(nullptr, | ||||
m_ErrorTexture.GetTexture()->GetBackendTexture()); | |||||
texture->m_State = CTexture::LOADED; | texture->m_State = CTexture::LOADED; | ||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
// We'll only push new conversion requests if it's not already busy | // We'll only push new conversion requests if it's not already busy | ||||
bool converterBusy = m_TextureConverter.IsBusy(); | bool converterBusy = m_TextureConverter.IsBusy(); | ||||
▲ Show 20 Lines • Show All 407 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
ok is useless now