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

Method Init

Source/Engine/Graphics/Graphics.cpp:101–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101bool GraphicsService::Init()
102{
103 ASSERT(GPUDevice::Instance == nullptr);
104 PROFILE_MEM(Graphics);
105
106 // Create and initialize graphics device
107 LOG_FLOOR();
108 LOG(Info, "Creating Graphics Device...");
109 PixelFormatExtensions::Init();
110 GPUDevice* device = nullptr;
111
112 // Null
113 if (!device && CommandLine::Options.Null.IsTrue())
114 {
115#if GRAPHICS_API_NULL
116 device = CreateGPUDeviceNull();
117#else
118 LOG(Warning, "Null backend not available");
119#endif
120 }
121
122 // Vulkan
123 if (!device && CommandLine::Options.Vulkan.IsTrue())
124 {
125#if GRAPHICS_API_VULKAN
126 device = CreateGPUDeviceVulkan();
127#else
128 LOG(Warning, "Vulkan backend not available");
129#endif
130 }
131
132 // DirectX 12
133 if (!device && CommandLine::Options.D3D12.IsTrue())
134 {
135#if GRAPHICS_API_DIRECTX12
136 if (Platform::IsWindows10())
137 {
138 device = CreateGPUDeviceDX12();
139 }
140#else
141 LOG(Warning, "DirectX 12 backend not available");
142#endif
143 }
144
145 // DirectX 11 and DirectX 10
146 if (!device && (CommandLine::Options.D3D11.IsTrue() || CommandLine::Options.D3D10.IsTrue()))
147 {
148#if GRAPHICS_API_DIRECTX11
149 device = CreateGPUDeviceDX11();
150#else
151 LOG(Warning, "DirectX 11 backend not available");
152#endif
153 }
154
155 // Platform default
156 if (!device)
157 {
158#if GRAPHICS_API_DIRECTX11

Callers 7

CreateMethod · 0.45
PrepareMethod · 0.45
GetMethod · 0.45
OnBeginMethod · 0.45
ResizeMethod · 0.45
FlushMethod · 0.45
DownloadDataAsyncMethod · 0.45

Calls 14

CreateGPUDeviceNullFunction · 0.85
CreateGPUDeviceVulkanFunction · 0.85
CreateGPUDeviceDX12Function · 0.85
CreateGPUDeviceDX11Function · 0.85
CreateGPUDeviceWebGPUFunction · 0.85
ToStringFunction · 0.70
InitFunction · 0.50
IsTrueMethod · 0.45
GetDescriptionMethod · 0.45
GetAdapterMethod · 0.45
GetFeatureLevelMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected