Lugdunum  0.1.0
Renderer.cpp
Go to the documentation of this file.
2 
12 
13 namespace lug {
14 namespace Graphics {
15 namespace Vulkan {
16 
17 const std::unordered_map<Module::Type, Renderer::Requirements> Renderer::modulesRequirements = {
18 #define LUG_INIT_GRAPHICS_MODULES_REQUIREMENTS(name) \
19  { \
20  Module::Type::name, ::lug::Graphics::Vulkan::Requirements::name::requirements \
21  },
22 
24 
25 #undef LUG_INIT_GRAPHICS_MODULES_REQUIREMENTS
26 };
27 
28 static VKAPI_ATTR VkBool32 VKAPI_CALL debugReportCallback(
29  VkDebugReportFlagsEXT flags,
30  VkDebugReportObjectTypeEXT /*objType*/,
31  uint64_t /*obj*/,
32  size_t /*location*/,
33  int32_t /*code*/,
34  const char* layerPrefix,
35  const char* msg,
36  void* /*userData*/) {
37 
38  // Convert VkDebugReportFlagsEXT to System::Logger::Level
39  System::Logger::Level level = System::Logger::Level::Off;
40 
41  if (flags & VK_DEBUG_REPORT_ERROR_BIT_EXT) {
42  level = System::Logger::Level::Error;
43  } else if (flags & VK_DEBUG_REPORT_WARNING_BIT_EXT || flags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT) {
44  level = System::Logger::Level::Warning;
45  } else if (flags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) {
46  level = System::Logger::Level::Info;
47  } else if (flags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) {
48  level = System::Logger::Level::Debug;
49  }
50 
51  LUG_LOG.log(level, "DebugReport: {}: {}", layerPrefix, msg);
52 
53  return VK_FALSE;
54 }
55 
57 
59  destroy();
60 }
61 
63  // Destroy the window
64  _window.reset();
65 
66  _resourceManager.reset();
67  _pipelines.clear();
68 
69  _device.destroy();
70 
71  // Destroy the report callback if necessary
72  {
73  if (isInstanceExtensionLoaded(VK_EXT_DEBUG_REPORT_EXTENSION_NAME)) {
74  auto vkDestroyDebugReportCallbackEXT = _instance.getProcAddr<PFN_vkDestroyDebugReportCallbackEXT>("vkDestroyDebugReportCallbackEXT");
75 
76  if (vkDestroyDebugReportCallbackEXT) {
77  vkDestroyDebugReportCallbackEXT(static_cast<VkInstance>(_instance), _debugReportCallback, nullptr);
78  }
79  }
80  }
81 
83  _loader.unload();
84 }
85 
86 bool Renderer::beginInit(const std::string& appName, const Core::Version& appVersion, const Renderer::InitInfo& initInfo) {
87  _initInfo = initInfo;
89 
90  if (!initInstance(appName, appVersion)) {
91  LUG_LOG.error("RendererVulkan: Can't init the instance");
92  return false;
93  }
94 
95  return true;
96 }
97 
99  // Is it a second time finishInit?
100  if (static_cast<VkDevice>(_device)) {
101  _device.waitIdle();
102 
103  // Destroy the render part of the window
104  if (_window) {
105  _window->destroyRender();
106  }
107 
108  _resourceManager.reset();
109  _pipelines.clear();
110 
111  _device.destroy();
112  }
113 
114  if (!initDevice()) {
115  LUG_LOG.error("RendererVulkan: Can't init the device");
116  return false;
117  }
118 
119 #if defined(LUG_DEBUG)
120  LUG_LOG.info("RendererVulkan: Use device {}", _physicalDeviceInfo->properties.deviceName);
121 #endif
122 
123  _resourceManager = std::make_unique<::lug::Graphics::ResourceManager>(*this);
124 
125  return true;
126 }
127 
128 bool Renderer::initInstance(const std::string& appName, const Core::Version& appVersion) {
129  VkResult result{VK_SUCCESS};
130 
131  // Load vulkan core functions
132  {
133  if (!_loader.loadCoreFunctions()) {
134  LUG_LOG.error("RendererVulkan: Can't load core vulkan functions");
135  return false;
136  }
137  }
138 
139  // Load instance properties
140  {
141  // Load instance extensions
142  {
143  uint32_t extensionsCount = 0;
144  result = vkEnumerateInstanceExtensionProperties(nullptr, &extensionsCount, nullptr);
145 
146  if (result != VK_SUCCESS) {
147  LUG_LOG.error("RendererVulkan: Can't enumerate instance extensions: {}", result);
148  return false;
149  }
150 
151  _instanceInfo.extensions.resize(extensionsCount);
152  result = vkEnumerateInstanceExtensionProperties(nullptr, &extensionsCount, _instanceInfo.extensions.data());
153 
154  if (result != VK_SUCCESS) {
155  LUG_LOG.error("RendererVulkan: Can't enumerate instance extensions: {}", result);
156  return false;
157  }
158  }
159 
160  // Load instance layers
161  {
162  uint32_t layersCount = 0;
163  result = vkEnumerateInstanceLayerProperties(&layersCount, nullptr);
164 
165  if (result != VK_SUCCESS) {
166  LUG_LOG.error("RendererVulkan: Can't enumerate instance layers: {}", result);
167  return false;
168  }
169 
170  _instanceInfo.layers.resize(layersCount);
171  result = vkEnumerateInstanceLayerProperties(&layersCount, _instanceInfo.layers.data());
172 
173  if (result != VK_SUCCESS) {
174  LUG_LOG.error("RendererVulkan: Can't enumerate instance layers: {}", result);
175  return false;
176  }
177  }
178  }
179 
180  // Create instance
181  {
182  // Check which layers / extensions to load for modules
184  return false;
185  }
186 
188 
189  // Build the instance
190  API::Builder::Instance instanceBuilder;
191 
192  instanceBuilder.setApplicationInfo(appName, appVersion);
193  instanceBuilder.setEngineInfo(LUG_NAME, {LUG_VERSION_MAJOR, LUG_VERSION_MINOR, LUG_VERSION_PATCH});
194 
195  instanceBuilder.setLayers(_loadedInstanceLayers);
196  instanceBuilder.setExtensions(_loadedInstanceExtensions);
197 
198  if (!instanceBuilder.build(_instance, &result)) {
199  LUG_LOG.error("RendererVulkan: Can't create the instance: {}", result);
200  return false;
201  }
202 
203  }
204 
205  // Create report callback if necessary
206  {
207  if (isInstanceExtensionLoaded(VK_EXT_DEBUG_REPORT_EXTENSION_NAME)) {
208  VkDebugReportCallbackCreateInfoEXT createInfo = {};
209  createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT;
210  // We don't want VK_DEBUG_REPORT_INFORMATION_BIT_EXT and not VK_DEBUG_REPORT_DEBUG_BIT_EXT
211  createInfo.flags = VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT | VK_DEBUG_REPORT_ERROR_BIT_EXT;
212  createInfo.pfnCallback = debugReportCallback;
213 
214  auto vkCreateDebugReportCallbackEXT = _instance.getProcAddr<PFN_vkCreateDebugReportCallbackEXT>("vkCreateDebugReportCallbackEXT");
215 
216  if (vkCreateDebugReportCallbackEXT) {
217  vkCreateDebugReportCallbackEXT(static_cast<VkInstance>(_instance), &createInfo, nullptr, &_debugReportCallback);
218  } else {
219  LUG_LOG.warn("RendererVulkan: Can't load function vkCreateDebugReportCallbackEXT");
220  }
221  }
222  }
223 
224  // Load vulkan instance functions
225  {
227  LUG_LOG.error("RendererVulkan: Can't load instance vulkan functions");
228  return false;
229  }
230  }
231 
232  // Load physical devices information
233  {
234  uint32_t physicalDevicesCount = 0;
235  result = vkEnumeratePhysicalDevices(static_cast<VkInstance>(_instance), &physicalDevicesCount, nullptr);
236 
237  if (result != VK_SUCCESS) {
238  LUG_LOG.error("RendererVulkan: Can't enumerate physical devices: {}", result);
239  return false;
240  }
241 
242  _physicalDeviceInfos.resize(physicalDevicesCount);
243 
244  std::vector<VkPhysicalDevice> physicalDevices(physicalDevicesCount);
245  result = vkEnumeratePhysicalDevices(static_cast<VkInstance>(_instance), &physicalDevicesCount, physicalDevices.data());
246 
247  if (result != VK_SUCCESS) {
248  LUG_LOG.error("RendererVulkan: Can't enumerate physical devices: {}", result);
249  return false;
250  }
251 
252  for (uint8_t idx = 0; idx < physicalDevicesCount; ++idx) {
253  _physicalDeviceInfos[idx].handle = physicalDevices[idx];
254 
255  vkGetPhysicalDeviceProperties(physicalDevices[idx], &(_physicalDeviceInfos[idx].properties));
256  vkGetPhysicalDeviceFeatures(physicalDevices[idx], &(_physicalDeviceInfos[idx].features));
257 
258  // Load queue families
259  {
260  uint32_t queueFamilyCount = 0;
261  vkGetPhysicalDeviceQueueFamilyProperties(physicalDevices[idx], &queueFamilyCount, nullptr);
262 
263  _physicalDeviceInfos[idx].queueFamilies.resize(queueFamilyCount);
264  vkGetPhysicalDeviceQueueFamilyProperties(physicalDevices[idx], &queueFamilyCount, _physicalDeviceInfos[idx].queueFamilies.data());
265  }
266 
267  vkGetPhysicalDeviceMemoryProperties(physicalDevices[idx], &(_physicalDeviceInfos[idx].memoryProperties));
268 
269  // Load device extensions
270  {
271  uint32_t extensionsCount = 0;
272  result = vkEnumerateDeviceExtensionProperties(physicalDevices[idx], nullptr, &extensionsCount, nullptr);
273 
274  if (result != VK_SUCCESS) {
275  LUG_LOG.error("RendererVulkan: Can't enumerate device extensions: {}", result);
276  return false;
277  }
278 
279  _physicalDeviceInfos[idx].extensions.resize(extensionsCount);
280  result = vkEnumerateDeviceExtensionProperties(physicalDevices[idx], nullptr, &extensionsCount, _physicalDeviceInfos[idx].extensions.data());
281 
282  if (result != VK_SUCCESS) {
283  LUG_LOG.error("RendererVulkan: Can't enumerate device extensions: {}", result);
284  return false;
285  }
286  }
287 
288  // Load images formats properties
289  {
290 #define LUG_LOAD_IMAGE_FORMAT_PROPERTIES(formatEnum) \
291  vkGetPhysicalDeviceFormatProperties(physicalDevices[idx], formatEnum, &_physicalDeviceInfos[idx].formatProperties[formatEnum]);
293 #undef LUG_LOAD_IMAGE_FORMAT_PROPERTIES
294  }
295 
296  // TODO: Get additional informations (images properties, etc)
297  }
298  }
299 
300  return true;
301 }
302 
304  VkResult result{VK_SUCCESS};
305 
306  if (_preferences.device) {
308 
309  // Set the loaded informations of the device
310  {
312  return false;
313  }
314 
316  }
317  } else {
318  // Select device
319  {
320  uint8_t matchedDeviceIdx = 0;
321  std::vector<uint8_t> matchedDevicesIdx{};
322 
323  for (uint8_t idx = 0; idx < _physicalDeviceInfos.size(); ++idx) {
325  continue;
326  }
327 
329 
330  matchedDevicesIdx.push_back(idx);
331 
332  }
333 
334  if (matchedDevicesIdx.size() == 0) {
335  LUG_LOG.error("RendererVulkan: Can't find a compatible device");
336  return false;
337  }
338 
339  // TODO: Add score
340  matchedDeviceIdx = matchedDevicesIdx[0];
341 
342  for (uint8_t idx : matchedDevicesIdx) {
343  if (_physicalDeviceInfos[idx].properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) {
344  matchedDeviceIdx = idx;
345  break;
346  }
347  }
348 
349  _physicalDeviceInfo = &(_physicalDeviceInfos[matchedDeviceIdx]);
350  }
351 
352  // Set the loaded informations of the matched device
353  {
356  }
357  }
358 
359  // Create device
360  {
361  // Build the device
363 
364  deviceBuilder.setExtensions(_loadedDeviceExtensions);
365  deviceBuilder.setFeatures(_loadedDeviceFeatures);
366 
367  if (!deviceBuilder.addQueues(VK_QUEUE_GRAPHICS_BIT, {"queue_graphics"}) ||
368  !deviceBuilder.addQueues(VK_QUEUE_TRANSFER_BIT, {"queue_transfer"})) {
369  return false;
370  }
371 
372  if (!deviceBuilder.build(_device, &result)) {
373  LUG_LOG.error("RendererVulkan: Can't create the device: {}", result);
374  return false;
375  }
376  }
377 
378  // Load vulkan device functions
379  {
381  LUG_LOG.error("RendererVulkan: Can't load device vulkan functions");
382  return false;
383  }
384  }
385 
386  return true;
387 }
388 
389 bool Renderer::checkRequirementsInstance(const std::set<Module::Type>& modulesToCheck) {
390  bool requirementsCheck = true;
391 
392  for (const auto moduleType : modulesToCheck) {
393  const auto& requirements = modulesRequirements.at(moduleType);
394 
395  std::vector<const char*> layers{};
396  std::vector<const char*> extensions{};
397 
398  bool moduleRequirementsCheck = true;
399 
400  // Check layers
401  {
402  const std::vector<const char*> layersNotFound = checkRequirementsLayers(_instanceInfo, requirements.mandatoryInstanceLayers, layers);
403  moduleRequirementsCheck = moduleRequirementsCheck && layersNotFound.size() == 0;
404 
405  for (const char* const layerName : layersNotFound) {
406  LUG_LOG.warn("Can't load mandatory layer '{}' for module '{}'", layerName, moduleType);
407  }
408  }
409 
410  {
411  const std::vector<const char*> layersNotFound = checkRequirementsLayers(_instanceInfo, requirements.optionalInstanceLayers, layers);
412 
413  for (const char* layerName : layersNotFound) {
414  LUG_LOG.warn("Can't load optional layer '{}' for module '{}'", layerName, moduleType);
415  }
416  }
417 
418  // Check extensions
419  {
420  const std::vector<const char*> extensionsNotFound = checkRequirementsExtensions(_instanceInfo, requirements.mandatoryInstanceExtensions, extensions);
421  moduleRequirementsCheck = moduleRequirementsCheck && extensionsNotFound.size() == 0;
422 
423  for (const char* const extensionName : extensionsNotFound) {
424  LUG_LOG.warn("Can't load mandatory extension '{}' for module '{}'", extensionName, moduleType);
425  }
426  }
427 
428  {
429  const std::vector<const char*> extensionsNotFound = checkRequirementsExtensions(_instanceInfo, requirements.optionalInstanceExtensions, extensions);
430 
431  for (const char* extensionName : extensionsNotFound) {
432  LUG_LOG.warn("Can't load optional extension '{}' for module '{}'", extensionName, moduleType);
433  }
434  }
435 
436  if (moduleRequirementsCheck) {
437  _loadedInstanceLayers.insert(_loadedInstanceLayers.end(), layers.begin(), layers.end());
438  _loadedInstanceExtensions.insert(_loadedInstanceExtensions.end(), extensions.begin(), extensions.end());
439  } else {
440  _graphics.unsupportedModule(moduleType);
441  }
442 
443  requirementsCheck = requirementsCheck && moduleRequirementsCheck;
444  }
445 
446  return requirementsCheck;
447 }
448 
449 bool Renderer::checkRequirementsDevice(const PhysicalDeviceInfo& physicalDeviceInfo, const std::set<Module::Type>& modulesToCheck, bool finalization, bool quiet) {
450  bool requirementsCheck = true;
451 
452  for (const auto moduleType : modulesToCheck) {
453  const auto& requirements = modulesRequirements.at(moduleType);
454 
455  std::vector<const char*> extensions{};
456  VkPhysicalDeviceFeatures features{};
457  std::set<int8_t> queueFamiliesIdx{};
458 
459  bool moduleRequirementsCheck = true;
460 
461  // Check extensions
462  {
463  const std::vector<const char*> extensionsNotFound = checkRequirementsExtensions(physicalDeviceInfo, requirements.mandatoryDeviceExtensions, extensions);
464  moduleRequirementsCheck = moduleRequirementsCheck && extensionsNotFound.size() == 0;
465 
466  if (!quiet) {
467  for (const char* const extensionName : extensionsNotFound) {
468  LUG_LOG.warn("Device {}: Can't load mandatory extension '{}' for module '{}'", physicalDeviceInfo.properties.deviceName, extensionName, moduleType);
469  }
470  }
471  }
472 
473  {
474  const std::vector<const char*> extensionsNotFound = checkRequirementsExtensions(physicalDeviceInfo, requirements.optionalDeviceExtensions, extensions);
475 
476  if (!quiet) {
477  for (const char* extensionName : extensionsNotFound) {
478  LUG_LOG.warn("Device {}: Can't load optional extension '{}' for module '{}'", physicalDeviceInfo.properties.deviceName, extensionName, moduleType);
479  }
480  }
481  }
482 
483  // TODO: Log error
484 #define LUG_CHECK_VULKAN_PHYSICAL_DEVICE_MANDATORY_FEATURES(featureName) \
485  { \
486  if (requirements.mandatoryFeatures.featureName == VK_TRUE) { \
487  if (physicalDeviceInfo.features.featureName == VK_TRUE) { \
488  features.featureName = VK_TRUE; \
489  } else { \
490  if (!quiet) { \
491  LUG_LOG.warn("Device {}: Can't load mandatory feature '{}' for module '{}'", physicalDeviceInfo.properties.deviceName, #featureName, moduleType); \
492  } \
493  moduleRequirementsCheck = false; \
494  } \
495  } \
496  }
498 #undef LUG_CHECK_VULKAN_PHYSICAL_DEVICE_MANDATORY_FEATURES
499 
500  // TODO: Log error
501 #define LUG_CHECK_VULKAN_PHYSICAL_DEVICE_OPTIONNAL_FEATURES(featureName) \
502  { \
503  if (requirements.optionalFeatures.featureName == VK_TRUE) { \
504  if (physicalDeviceInfo.features.featureName == VK_TRUE) { \
505  features.featureName = VK_TRUE; \
506  } else if (!quiet) { \
507  LUG_LOG.warn("Device {}: Can't load optional feature '{}' for module '{}'", physicalDeviceInfo.properties.deviceName, #featureName, moduleType); \
508  } \
509  } \
510  }
512 #undef LUG_CHECK_VULKAN_PHYSICAL_DEVICE_MANDATORY_FEATURES
513 
514  if (finalization) {
515  if (moduleRequirementsCheck) {
516  _loadedDeviceExtensions.insert(_loadedDeviceExtensions.end(), extensions.begin(), extensions.end());
517 
518 #define LUG_FILL_VULKAN_PHYSICAL_DEVICE_FEATURES(featureName) _loadedDeviceFeatures.featureName = _loadedDeviceFeatures.featureName || features.featureName;
520 #undef LUG_FILL_VULKAN_PHYSICAL_DEVICE_FEATURES
521  } else {
522  _graphics.unsupportedModule(moduleType);
523  }
524  }
525 
526  requirementsCheck = requirementsCheck && moduleRequirementsCheck;
527  }
528 
529  return requirementsCheck;
530 }
531 
532 template<typename Info>
533 inline std::vector<const char*> Renderer::checkRequirementsLayers(const Info& info, const std::vector<const char*>& layers, std::vector<const char*>& layersFound) {
534  std::vector<const char*> layersNotFound{};
535 
536  for (const char* layerName : layers) {
537  if (info.containsLayer(layerName)) {
538  layersFound.push_back(layerName);
539  } else {
540  layersNotFound.push_back(layerName);
541  }
542  }
543 
544  return layersNotFound;
545 }
546 
547 template<typename Info>
548 inline std::vector<const char*> Renderer::checkRequirementsExtensions(const Info& info, const std::vector<const char*>& extensions, std::vector<const char*>& extensionsFound) {
549  std::vector<const char*> extensionsNotFound{};
550 
551  for (const char* extensionName : extensions) {
552  if (info.containsExtension(extensionName)) {
553  extensionsFound.push_back(extensionName);
554  } else {
555  extensionsNotFound.push_back(extensionName);
556  }
557  }
558 
559  return extensionsNotFound;
560 }
561 
563  if (!_window) {
564  _window = Render::Window::create(*this, initInfo);
565  }
566 
567  if (!_window->initRender()) {
568  _window.reset();
569  }
570 
571  return _window.get();
572 }
573 
575  return _window.get();
576 }
577 
578 bool Renderer::beginFrame(const lug::System::Time& elapsedTime) {
579  return _window->beginFrame(elapsedTime);
580 }
581 
583  if (!_window->render()) {
584  return false;
585  }
586 
587  for (auto& renderView: _window->getRenderViews()) {
588  if (!renderView->endFrame()) {
589  return false;
590  }
591  }
592 
593  return _window->endFrame();
594 }
595 
596 } // Vulkan
597 } // Graphics
598 } // lug
#define LUG_NAME
Definition: Config.hpp:4
Stores the version of the Application.
Definition: Version.hpp:9
#define LUG_INIT_GRAPHICS_MODULES_REQUIREMENTS(name)
const Renderer::Requirements requirements
Definition: Core.hpp:11
void setExtensions(const std::vector< const char *> &extensions)
Definition: Device.inl:1
const std::vector< const char * > optionalInstanceExtensions
Definition: Renderer.hpp:28
const std::vector< const char * > mandatoryInstanceLayers
Definition: Renderer.hpp:25
::lug::Graphics::Render::Window * getWindow() override final
Definition: Renderer.cpp:574
Function getProcAddr(const char *name) const
const std::vector< const char * > optionalDeviceExtensions
Definition: Renderer.hpp:30
bool endFrame() override final
Definition: Renderer.cpp:582
static VKAPI_ATTR VkBool32 VKAPI_CALL debugReportCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT, uint64_t, size_t, int32_t, const char *layerPrefix, const char *msg, void *)
Definition: Renderer.cpp:28
static const std::unordered_map< Module::Type, Requirements > modulesRequirements
Definition: Renderer.hpp:153
#define LUG_VERSION_MAJOR
Definition: Config.hpp:6
uint8_t addQueues(VkQueueFlags queueFlags, const std::vector< std::string > &queuesNames)
Definition: Device.cpp:23
std::vector< VkExtensionProperties > extensions
Definition: Vulkan.hpp:171
std::vector< const char * > checkRequirementsLayers(const Info &info, const std::vector< const char *> &layers, std::vector< const char *> &layersFound)
Definition: Renderer.cpp:533
std::vector< const char * > _loadedInstanceExtensions
Definition: Renderer.hpp:126
static std::unique_ptr< Window > create(lug::Graphics::Vulkan::Renderer &renderer, Window::InitInfo &initInfo)
Definition: Window.cpp:199
std::vector< const char * > _loadedInstanceLayers
Definition: Renderer.hpp:125
bool beginInit(const std::string &appName, const Core::Version &appVersion, const Renderer::InitInfo &initInfo) override final
Definition: Renderer.cpp:86
bool initInstance(const std::string &appName, const Core::Version &appVersion)
Definition: Renderer.cpp:128
DisplayMode _displayMode
Definition: Renderer.hpp:72
const std::set< Module::Type > & getLoadedMandatoryModules() const
Definition: Graphics.inl:8
bool beginFrame(const lug::System::Time &elapsedTime) override final
Definition: Renderer.cpp:578
std::unordered_map< Render::Pipeline::Id, Resource::WeakPtr< Render::Pipeline > > _pipelines
Definition: Renderer.hpp:150
void setApplicationInfo(const std::string &name, const Core::Version &version={0, 0, 0})
Definition: Instance.inl:1
const std::vector< const char * > mandatoryDeviceExtensions
Definition: Renderer.hpp:26
bool build(API::Device &device, VkResult *returnResult=nullptr)
Definition: Device.cpp:49
#define LUG_CHECK_VULKAN_PHYSICAL_DEVICE_MANDATORY_FEATURES(featureName)
bool loadInstanceFunctions(const Instance &instance)
Definition: Loader.cpp:52
#define LUG_VULKAN_FORMAT(macro)
Definition: Enum.hpp:10
bool isInstanceExtensionLoaded(const char *name) const
Definition: Renderer.inl:9
VkDebugReportCallbackEXT _debugReportCallback
Definition: Renderer.hpp:121
#define LUG_GRAPHICS_MODULES(macro)
Definition: Module.hpp:11
std::unique_ptr< Render::Window > _window
Definition: Renderer.hpp:123
Renderer(Graphics &graphics)
Definition: Renderer.cpp:56
#define LUG_VERSION_PATCH
Definition: Config.hpp:8
bool loadDeviceFunctions(const Device &device)
Definition: Loader.cpp:69
VkPhysicalDeviceFeatures _loadedDeviceFeatures
Definition: Renderer.hpp:128
std::unique_ptr< ResourceManager > _resourceManager
Definition: Renderer.hpp:74
std::vector< PhysicalDeviceInfo > _physicalDeviceInfos
Definition: Renderer.hpp:119
bool checkRequirementsDevice(const PhysicalDeviceInfo &physicalDeviceInfo, const std::set< Module::Type > &modulesToCheck, bool finalization, bool quiet)
Definition: Renderer.cpp:449
void setFeatures(VkPhysicalDeviceFeatures features)
Definition: Device.inl:5
#define LUG_VULKAN_PHYSICAL_DEVICE_FEATURES(macro)
Definition: Requirements.hpp:3
bool checkRequirementsInstance(const std::set< Module::Type > &modulesToCheck)
Definition: Renderer.cpp:389
const std::vector< const char * > optionalInstanceLayers
Definition: Renderer.hpp:29
std::vector< const char * > checkRequirementsExtensions(const Info &info, const std::vector< const char *> &extensions, std::vector< const char *> &extensionsFound)
Definition: Renderer.cpp:548
const std::vector< const char * > mandatoryInstanceExtensions
Definition: Renderer.hpp:24
#define LUG_LOG
Definition: Logger.hpp:73
#define LUG_VERSION_MINOR
Definition: Config.hpp:7
#define LUG_CHECK_VULKAN_PHYSICAL_DEVICE_OPTIONNAL_FEATURES(featureName)
#define LUG_FILL_VULKAN_PHYSICAL_DEVICE_FEATURES(featureName)
std::vector< const char * > _loadedDeviceExtensions
Definition: Renderer.hpp:127
const std::set< Module::Type > & getLoadedOptionalModules() const
Definition: Graphics.inl:12
void unsupportedModule(Module::Type type)
Definition: Graphics.cpp:75
#define LUG_LOAD_IMAGE_FORMAT_PROPERTIES(formatEnum)
::lug::Graphics::Render::Window * createWindow(Render::Window::InitInfo &initInfo) override final
Definition: Renderer.cpp:562
VkPhysicalDeviceProperties properties
Definition: Vulkan.hpp:181
std::vector< VkLayerProperties > layers
Definition: Vulkan.hpp:172
bool finishInit() override final
Definition: Renderer.cpp:98
Class for graphics.
Definition: Graphics.hpp:25
PhysicalDeviceInfo * _physicalDeviceInfo
Definition: Renderer.hpp:118