diff --git a/src/Layers/xrRender/ResourceManager.cpp b/src/Layers/xrRender/ResourceManager.cpp index 74a65bfafb6..9ea1c5c98f1 100644 --- a/src/Layers/xrRender/ResourceManager.cpp +++ b/src/Layers/xrRender/ResourceManager.cpp @@ -349,7 +349,7 @@ void CResourceManager::DeferredUpload() return; #ifndef MASTER_GOLD - Msg("%s, amount of textures = %d", __FUNCTION__, m_textures.size()); + Msg("%s, amount of textures: %d", __FUNCTION__, m_textures.size()); CTimer timer; timer.Start(); @@ -363,7 +363,7 @@ void CResourceManager::DeferredUpload() #endif #ifndef MASTER_GOLD - Msg("%s, texture loading time = %d", __FUNCTION__, timer.GetElapsed_ms()); + Msg("%s, texture loading time: %d ms", __FUNCTION__, timer.GetElapsed_ms()); #endif } /* diff --git a/src/Layers/xrRender/TextureDescrManager.cpp b/src/Layers/xrRender/TextureDescrManager.cpp index 94f0372c35a..d14dab9c519 100644 --- a/src/Layers/xrRender/TextureDescrManager.cpp +++ b/src/Layers/xrRender/TextureDescrManager.cpp @@ -1,5 +1,7 @@ #include "stdafx.h" -#pragma hdrstop + +#include + #include "TextureDescrManager.h" #include "ETextureParams.h" @@ -28,27 +30,25 @@ void CTextureDescrMngr::LoadTHM(LPCSTR initial) { FS_FileSet flist; FS.file_list(flist, initial, FS_ListFiles, "*.thm"); -#ifdef DEBUG - Msg("count of .thm files=%d", flist.size()); -#endif // #ifdef DEBUG - auto It = flist.begin(); - auto It_e = flist.end(); - STextureParams tp; - string_path fn; - for (; It != It_e; ++It) +#ifndef MASTER_GOLD + Msg("%s, count of .thm files: %d", __FUNCTION__, flist.size()); +#endif + + tbb::parallel_for_each(flist, [&](auto& it) { -#ifdef DEBUG +#if 0//def DEBUG // XXX: make it as an option //Alundaio: Print list of *.thm to find bad .thms! - Msg("%s", (*It).name.c_str()); + Msg("%s", it.name.c_str()); #endif - FS.update_path(fn, initial, (*It).name.c_str()); + string_path fn; + FS.update_path(fn, initial, it.name.c_str()); IReader* F = FS.r_open(fn); - xr_strcpy(fn, (*It).name.c_str()); + xr_strcpy(fn, it.name.c_str()); fix_texture_thm_name(fn); R_ASSERT(F->find_chunk(THM_CHUNK_TYPE)); F->r_u32(); - tp.Clear(); + STextureParams tp; tp.Load(*F); FS.r_close(F); if (STextureParams::ttImage == tp.type || STextureParams::ttTerrain == tp.type || @@ -95,43 +95,38 @@ void CTextureDescrMngr::LoadTHM(LPCSTR initial) desc.m_spec->m_use_steep_parallax = true; } } - } + }); } void CTextureDescrMngr::Load() { -#ifdef DEBUG - CTimer TT; - TT.Start(); +#ifndef MASTER_GOLD + CTimer timer; + timer.Start(); #endif // #ifdef DEBUG LoadTHM("$game_textures$"); LoadTHM("$level$"); -#ifdef DEBUG - Msg("load time=%d ms", TT.GetElapsed_ms()); -#endif // #ifdef DEBUG +#ifndef MASTER_GOLD + Msg("%s, .thm loading time: %d ms", __FUNCTION__, timer.GetElapsed_ms()); +#endif } void CTextureDescrMngr::UnLoad() { - map_TD::iterator I = m_texture_details.begin(); - map_TD::iterator E = m_texture_details.end(); - for (; I != E; ++I) + for (auto& it : m_texture_details) { - xr_delete(I->second.m_assoc); - xr_delete(I->second.m_spec); + xr_delete(it.second.m_assoc); + xr_delete(it.second.m_spec); } m_texture_details.clear(); } CTextureDescrMngr::~CTextureDescrMngr() { - map_CS::iterator I = m_detail_scalers.begin(); - map_CS::iterator E = m_detail_scalers.end(); - - for (; I != E; ++I) - xr_delete(I->second); + for (auto& it : m_detail_scalers) + xr_delete(it.second); m_detail_scalers.clear(); }