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

Method Init

Source/Engine/Platform/Base/PlatformBase.cpp:134–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134bool PlatformBase::Init()
135{
136#if BUILD_DEBUG
137 // Validate atomic and interlocked operations
138 int64 data = 0;
139 Platform::AtomicStore(&data, 11);
140 ASSERT(Platform::AtomicRead(&data) == 11);
141 ASSERT(Platform::InterlockedAdd(&data, 2) == 11);
142 ASSERT(Platform::AtomicRead(&data) == 13);
143 ASSERT(Platform::InterlockedIncrement(&data) == 14);
144 ASSERT(Platform::AtomicRead(&data) == 14);
145 ASSERT(Platform::InterlockedDecrement(&data) == 13);
146 ASSERT(Platform::AtomicRead(&data) == 13);
147 ASSERT(Platform::InterlockedExchange(&data, 10) == 13);
148 ASSERT(Platform::AtomicRead(&data) == 10);
149 ASSERT(Platform::InterlockedCompareExchange(&data, 11, 0) == 10);
150 ASSERT(Platform::AtomicRead(&data) == 10);
151 ASSERT(Platform::InterlockedCompareExchange(&data, 11, 10) == 10);
152 ASSERT(Platform::AtomicRead(&data) == 11);
153#endif
154
155 srand((unsigned int)Platform::GetTimeCycles());
156
157 // Preallocate safety dynamic buffer to be released before Out Of Memory reporting to ensure code can properly execute
158#ifndef PLATFORM_OUT_OF_MEMORY_BUFFER_SIZE
159#define PLATFORM_OUT_OF_MEMORY_BUFFER_SIZE (1ull * 1024 * 1024) // 1 MB
160#endif
161 OutOfMemoryBuffer = Allocator::Allocate(PLATFORM_OUT_OF_MEMORY_BUFFER_SIZE);
162
163 return false;
164}
165
166void PlatformBase::LogInfo()
167{

Callers 1

RunMethod · 0.45

Calls 7

AtomicStoreFunction · 0.50
AtomicReadFunction · 0.50
InterlockedAddFunction · 0.50
InterlockedIncrementFunction · 0.50
InterlockedDecrementFunction · 0.50
InterlockedExchangeFunction · 0.50

Tested by

no test coverage detected