MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Init

Method Init

Source/Engine/Content/Content.cpp:127–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125ContentService ContentServiceInstance;
126
127bool ContentService::Init()
128{
129 PROFILE_MEM(Content);
130
131 // Init memory containers
132 Assets.EnsureCapacity(2048);
133 LoadedAssetsToInvoke.EnsureCapacity(64);
134#if PLATFORM_THREADS_LIMIT > 1
135 LoadCallAssets.EnsureCapacity(PLATFORM_THREADS_LIMIT);
136#endif
137
138 // Load assets registry
139 Cache.Init();
140
141 // Create loading threads
142 MainLoadThread = New<LoadingThread>();
143 ThisLoadThread = MainLoadThread;
144#if PLATFORM_THREADS_LIMIT > 1
145 const CPUInfo cpuInfo = Platform::GetCPUInfo();
146 const int32 count = Math::Clamp(Math::CeilToInt(LOADING_THREAD_PER_LOGICAL_CORE * (float)cpuInfo.LogicalProcessorCount), 1, 12);
147 LOG(Info, "Creating {0} content loading threads...", count);
148 LoadThreads.Resize(count);
149 for (int32 i = 0; i < count; i++)
150 {
151 auto thread = New<LoadingThread>();
152 LoadThreads[i] = thread;
153 if (thread->Start(String::Format(TEXT("Load Thread {0}"), i)))
154 {
155 LOG(Fatal, "Cannot spawn content thread {0}/{1}", i, count);
156 Delete(thread);
157 return true;
158 }
159 }
160#endif
161
162 return false;
163}
164
165void ContentService::Update()
166{

Callers

nothing calls this directly

Calls 7

ClampFunction · 0.85
DeleteFunction · 0.85
CeilToIntFunction · 0.50
FormatFunction · 0.50
EnsureCapacityMethod · 0.45
ResizeMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected