MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / prefetch

Method prefetch

ogsr_engine/xr_3da/IGame_ObjectPool.cpp:12–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10IGame_ObjectPool::~IGame_ObjectPool(void) { R_ASSERT(m_PrefetchObjects.empty()); }
11
12void IGame_ObjectPool::prefetch()
13{
14 // в огср замороченный префетч объектов (не моделей), требует много переделок в xrGame, потому пусть работает только в тч-режиме.
15 if (CApplication::CheckCsCopMode())
16 return;
17
18 R_ASSERT(m_PrefetchObjects.empty());
19
20 int p_count = 0;
21 ::Render->model_Logging(FALSE);
22
23 string256 section;
24 // prefetch objects
25 strconcat(sizeof(section), section, "prefetch_objects_", g_pGamePersistent->m_game_params.m_game_type);
26 if (pSettings->section_exist(section))
27 {
28 const auto& sect = pSettings->r_section(section);
29 CTimer T;
30 T.Start();
31 Render->models_begin_prefetch1(true);
32 for (const auto& item : sect.Ordered_Data)
33 {
34 if (pSettings->section_exist(item.first.c_str()))
35 {
36 CLASS_ID CLS = pSettings->r_clsid(item.first.c_str(), "class");
37 p_count++;
38 CObject* pObject = (CObject*)NEW_INSTANCE(CLS);
39 pObject->Load(item.first.c_str());
40 pObject->reload(item.first.c_str());
41 VERIFY2(pObject->cNameSect().c_str(), item.first.c_str());
42 m_PrefetchObjects.push_back(pObject);
43 }
44 else
45 Msg("! [%s] unknown section %s in %s", __FUNCTION__, item.first.c_str(), section);
46 }
47 Render->models_begin_prefetch1(false);
48 Msg("[%s] objects prefetching time (%zi): [%.2f s.]", __FUNCTION__, p_count, T.GetElapsed_sec());
49 }
50
51 // out statistic
52 ::Render->model_Logging(TRUE);
53}
54
55void IGame_ObjectPool::clear()
56{

Callers 1

OnGameStartMethod · 0.80

Calls 11

MsgFunction · 0.85
model_LoggingMethod · 0.80
section_existMethod · 0.80
r_clsidMethod · 0.80
emptyMethod · 0.45
StartMethod · 0.45
c_strMethod · 0.45
LoadMethod · 0.45
reloadMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected