Skip to content

Commit 37c4d0a

Browse files
committed
Многопоточная загрузка текстур будет вкл/выкл командой r_mt_texload
1 parent 26186eb commit 37c4d0a

File tree

7 files changed

+25
-5
lines changed

7 files changed

+25
-5
lines changed

Game/Resources_SoC_1.0006/gamedata/config/text/eng/ui_st_mm.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@
242242
<string id="ui_mm_terrain_parallax">
243243
<text>Parallax on terrain</text>
244244
</string>
245+
<string id="ui_mm_mt_texload">
246+
<text>Multi-threaded texture loading</text>
247+
</string>
245248
<string id="ui_mm_dof">
246249
<text>Depth of field</text>
247250
</string>
@@ -782,7 +785,7 @@
782785
<text>Shadow map resolution (r__smap_size)</text>
783786
</string>
784787
<string id="video_settings_name_60">
785-
<text>Ìíîãîïîòî÷íàÿ çàãðóçêà òåêñòóð - rs_mt_texload</text>
788+
<text>Multi-threaded texture loading - r_mt_texload</text>
786789
</string>
787790
<string id="video_settings_name_61">
788791
<text>Field of view (fov)</text>

Game/Resources_SoC_1.0006/gamedata/config/text/rus/ui_st_mm.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@
242242
<string id="ui_mm_terrain_parallax">
243243
<text>Parallax on terrain</text>
244244
</string>
245+
<string id="ui_mm_mt_texload">
246+
<text>Ìíîãîïîòî÷íàÿ çàãðóçêà òåêñòóð</text>
247+
</string>
245248
<string id="ui_mm_dof">
246249
<text>Ãëóáèíà ðåçêîñòè</text>
247250
</string>
@@ -782,7 +785,7 @@
782785
<text>Ðàçðåøåíèå êàðò òåíåé - r__smap_size</text>
783786
</string>
784787
<string id="video_settings_name_60">
785-
<text>Ìíîãîïîòî÷íàÿ çàãðóçêà òåêñòóð - rs_mt_texload</text>
788+
<text>Ìíîãîïîòî÷íàÿ çàãðóçêà òåêñòóð - r_mt_texload</text>
786789
</string>
787790
<string id="video_settings_name_61">
788791
<text>Óãîë îáçîðà - fov</text>

Game/Resources_SoC_1.0006/gamedata/config/ui/ui_mm_opt.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,13 @@
597597
<options_item entry="r_terrain_parallax_enable" group="mm_opt_video_adv"/>
598598
</check_terrain_parallax>
599599

600+
<cap_mt_texload x="5" y="5" width="143" height="21">
601+
<text font="letterica16" r="215" g="195" b="170">ui_mm_mt_texload</text>
602+
</cap_mt_texload>
603+
<check_mt_texload x="249" y="0" width="30" height="21">
604+
<options_item entry="r_mt_texload" group="mm_opt_video_adv"/>
605+
</check_mt_texload>
606+
600607
<btn_to_simply x="342" y="325" width="111" height="29">
601608
<text align="c" font="letterica16" r="227" g="199" b="178">ui_mm_simply</text>
602609
<texture>ui_button_ordinary</texture>

Game/Resources_SoC_1.0006/gamedata/scripts/ui_mm_opt_video_adv.script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ local adv_vid_opt_params = {
8080
{ "r2_actor_shadow", "check", 0, hint_colors.green , "video_settings_name_56", "", only_2a_and_more_mode },
8181
{ "r_sslr_enable", "check", 1, hint_colors.yellow, "", "", only_4_and_more_mode },
8282
{ "3d_scopes_fps_factor", "track", 0, hint_colors.red , "video_settings_name_64", "video_settings_desc_64", },
83+
{ "mt_texload", "check", 0, hint_colors.green , "video_settings_name_60", "", only_2a_and_more_mode },
8384
}
8485

8586
local control_init_funs = {

ogsr_engine/Layers/xrRender/ResourceManager.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,14 @@ void CResourceManager::DeferredUpload()
371371
if (!RDEVICE.b_is_Ready)
372372
return;
373373

374-
Msg("CResourceManager::DeferredUpload MT -> START, size = [%u]", m_textures.size());
374+
Msg("CResourceManager::DeferredUpload [%s] -> START, size = [%u]", ps_r2_ls_flags_ext.test(R2FLAGEXT_MT_TEXLOAD) ? "MT" : "NO MT", m_textures.size());
375375

376376
// Теперь многопоточная загрузка текстур даёт очень существенный прирост скорости, проверено.
377-
std::for_each(std::execution::par_unseq, m_textures.begin(), m_textures.end(), [](auto& pair) { pair.second->Load(); });
377+
if (ps_r2_ls_flags_ext.test(R2FLAGEXT_MT_TEXLOAD))
378+
std::for_each(std::execution::par_unseq, m_textures.begin(), m_textures.end(), [](auto& pair) { pair.second->Load(); });
379+
else
380+
for (auto& pair : m_textures)
381+
pair.second->Load();
378382

379383
Msg("CResourceManager::DeferredUpload -> END");
380384
}

ogsr_engine/Layers/xrRender/xrRender_console.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Flags32 ps_r2_ls_flags = {R2FLAG_SUN
135135
R2FLAG_SUN_FOCUS | R2FLAG_SUN_TSM | R2FLAG_TONEMAP | R2FLAG_VOLUMETRIC_LIGHTS}; // r2-only
136136

137137
Flags32 ps_r2_ls_flags_ext = {
138-
/*R2FLAGEXT_SSAO_OPT_DATA |*/ R2FLAGEXT_SSAO_HALF_DATA | R2FLAGEXT_ENABLE_TESSELLATION | R2FLAGEXT_RAIN_DROPS | R2FLAGEXT_RAIN_DROPS_CONTROL
138+
/*R2FLAGEXT_SSAO_OPT_DATA |*/ R2FLAGEXT_SSAO_HALF_DATA | R2FLAGEXT_ENABLE_TESSELLATION | R2FLAGEXT_RAIN_DROPS | R2FLAGEXT_RAIN_DROPS_CONTROL | R2FLAGEXT_MT_TEXLOAD
139139
#if RENDER == R_R4
140140
| R2FLAGEXT_SSLR
141141
#endif
@@ -818,6 +818,7 @@ void xrRender_initconsole()
818818
#endif
819819

820820
CMD3(CCC_Mask, "r_terrain_parallax_enable", &ps_r2_ls_flags_ext, R2FLAGEXT_TERRAIN_PARALLAX);
821+
CMD3(CCC_Mask, "r_mt_texload", &ps_r2_ls_flags_ext, R2FLAGEXT_MT_TEXLOAD);
821822

822823
CMD3(CCC_Mask, "r2_sun", &ps_r2_ls_flags, R2FLAG_SUN);
823824
CMD3(CCC_Mask, "r2_sun_details", &ps_r2_ls_flags, R2FLAG_SUN_DETAILS);

ogsr_engine/Layers/xrRender/xrRender_console.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ enum
219219
R2FLAG_VISOR_REFL = 1 << 16,
220220
R2FLAG_VISOR_REFL_CONTROL = 1 << 17,
221221
R2FLAGEXT_TERRAIN_PARALLAX = 1 << 18,
222+
R2FLAGEXT_MT_TEXLOAD = 1 << 19,
222223
};
223224

224225
extern void xrRender_initconsole();

0 commit comments

Comments
 (0)