MCPcopy Create free account
hub / github.com/carbonengine/trinity / InitializeTrinity

Function InitializeTrinity

trinity/trinity.cpp:188–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186#endif
187
188void InitializeTrinity()
189{
190 TrinityALCrashes = BeCrashes;
191
192 GlobalStore().RegisterVariable( "BlitOriginal", static_cast<ITr2TextureProvider*>( nullptr ) );
193 GlobalStore().RegisterVariable( "BlitCurrent", static_cast<ITr2TextureProvider*>( nullptr ) );
194 GlobalStore().RegisterVariable( "g_texelSize", Vector4() );
195
196#if TRINITY_PLATFORM == TRINITY_METAL
197 bool isUsingMetalValidation = false;
198 if( auto type = getenv( "METAL_DEVICE_WRAPPER_TYPE" ) )
199 {
200 isUsingMetalValidation = strcmp( type, "0" ) != 0;
201 }
202#endif
203
204#if TRINITY_PLATFORM_SUPPORTS_PARALLEL_CONTEXTS
205 extern bool g_useParallelEncoding;
206 auto parallelRenderArg = BeOS->GetStartupArgValue( L"parallelrender" );
207 if( parallelRenderArg == L"1" )
208 {
209 g_useParallelEncoding = true;
210 }
211 else if( parallelRenderArg == L"0" )
212 {
213 g_useParallelEncoding = false;
214 }
215#if TRINITY_PLATFORM == TRINITY_METAL
216 if( g_useParallelEncoding && isUsingMetalValidation )
217 {
218 g_useParallelEncoding = false;
219 CCP_LOGWARN( "Disabled parallel encoding because of metal validation is present and that may cause stalls during parallel encoding" );
220 }
221#endif
222 if( g_useParallelEncoding )
223 {
224 CCP_LOGNOTICE( "trinity is using parallel encoding" );
225 }
226 else
227 {
228 CCP_LOGNOTICE( "trinity is not using parallel encoding" );
229 }
230#endif
231
232 auto upsclingDebugArg = BeOS->GetStartupArgValue( L"upscalingDebug" );
233 if( !upsclingDebugArg.empty() )
234 {
235 g_upscalingDebug = upsclingDebugArg == L"1";
236 }
237
238 auto debugArg = BeOS->GetStartupArgValue( L"deviceDebug" );
239 if( !debugArg.empty() )
240 {
241 g_requestDeviceDebugLayer = debugArg == L"1";
242 }
243
244 auto markersArg = BeOS->GetStartupArgValue( L"gpuMarkers" );
245 if( !markersArg.empty() )

Callers 1

StartDLLFunction · 0.85

Calls 5

PerlinNoise1DFunction · 0.85
RegisterVariableMethod · 0.80
emptyMethod · 0.80
Vector4Class · 0.50
InitializeFunction · 0.50

Tested by

no test coverage detected