Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/TextureConverter.cpp
Show First 20 Lines • Show All 492 Lines • ▼ Show 20 Lines | |||||
return false; | return false; | ||||
#endif // !CONFIG2_NVTT | #endif // !CONFIG2_NVTT | ||||
} | } | ||||
void CTextureConverter::RunThread(CTextureConverter* textureConverter) | void CTextureConverter::RunThread(CTextureConverter* textureConverter) | ||||
{ | { | ||||
#if CONFIG2_NVTT | #if CONFIG2_NVTT | ||||
debug_SetThreadName("TextureConverter"); | debug_SetThreadName("TextureConverter"); | ||||
g_Profiler2.RegisterCurrentThread("texconv"); | g_Profiler2->RegisterCurrentThread("texconv"); | ||||
// Wait until the main thread wakes us up | // Wait until the main thread wakes us up | ||||
while (true) | while (true) | ||||
{ | { | ||||
// We may have several textures in the incoming queue, process them all before going back to sleep. | // We may have several textures in the incoming queue, process them all before going back to sleep. | ||||
if (!textureConverter->IsBusy()) { | if (!textureConverter->IsBusy()) { | ||||
std::unique_lock<std::mutex> wait_lock(textureConverter->m_WorkerMutex); | std::unique_lock<std::mutex> wait_lock(textureConverter->m_WorkerMutex); | ||||
// Use the no-condition variant because spurious wake-ups don't matter that much here. | // Use the no-condition variant because spurious wake-ups don't matter that much here. | ||||
textureConverter->m_WorkerCV.wait(wait_lock); | textureConverter->m_WorkerCV.wait(wait_lock); | ||||
} | } | ||||
g_Profiler2.RecordSyncMarker(); | g_Profiler2->RecordSyncMarker(); | ||||
PROFILE2_EVENT("wakeup"); | PROFILE2_EVENT("wakeup"); | ||||
std::shared_ptr<ConversionRequest> request; | std::shared_ptr<ConversionRequest> request; | ||||
{ | { | ||||
std::lock_guard<std::mutex> wait_lock(textureConverter->m_WorkerMutex); | std::lock_guard<std::mutex> wait_lock(textureConverter->m_WorkerMutex); | ||||
if (textureConverter->m_Shutdown) | if (textureConverter->m_Shutdown) | ||||
break; | break; | ||||
Show All 32 Lines |
Wildfire Games · Phabricator