Skip to content

Commit

Permalink
Disable multithreaded texture loading for OpenGL renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Jan 29, 2018
1 parent 3dd786b commit b8cb425
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Layers/xrRender/ResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ void CResourceManager::Delete(const Shader* S)
Msg("! ERROR: Failed to find complete shader");
}

#ifndef USE_OGL
xr_vector<CTexture*> textures_to_load;

void LoadTextures(const size_t thread_num, const size_t textures_per_worker)
Expand All @@ -366,6 +367,7 @@ void LoadTextures(const size_t thread_num, const size_t textures_per_worker)
Msg("Thread %d, texture loading time = %d", thread_num, timer.GetElapsed_ms());
#endif
}
#endif

void CResourceManager::DeferredUpload()
{
Expand All @@ -379,6 +381,7 @@ void CResourceManager::DeferredUpload()
timer.Start();
#endif

#ifndef USE_OGL
const auto nWorkers = ttapi.threads.size();
const auto textures_per_worker = m_textures.size() / nWorkers;

Expand All @@ -391,6 +394,10 @@ void CResourceManager::DeferredUpload()
ttapi.wait();

textures_to_load.clear();
#else
for (auto& texture : m_textures)
texture.second->Load();
#endif

#ifndef MASTER_GOLD
Msg("%s, texture loading time = %d", __FUNCTION__, timer.GetElapsed_ms());
Expand Down

0 comments on commit b8cb425

Please sign in to comment.