16 #include <vulkan/vulkan.h> 18 #include <GLFW/glfw3.h> 27 Logger::logInfo(
"Checking Vulkan support...");
28 if (glfwVulkanSupported()) {
29 Logger::logInfo(
"Vulkan is supported!");
31 Logger::logError(
"Vulkan is not supported, you may want to update your graphics driver.");
35 Logger::logInfo(
"Checking Vulkan layers...");
38 uint32_t availableLayerCount = 0;
39 vkEnumerateInstanceLayerProperties(&availableLayerCount,
nullptr);
42 vector<VkLayerProperties> availableLayers(availableLayerCount);
43 vkEnumerateInstanceLayerProperties(&availableLayerCount, availableLayers.data());
46 vector<const char*> requiredLayers;
47 requiredLayers.push_back(
"VK_LAYER_LUNARG_standard_validation");
50 for (uint32_t i = 0; i < requiredLayers.size(); i++) {
52 for (uint32_t j = 0; j < availableLayers.size(); j++) {
53 if (strcmp(requiredLayers[i], availableLayers[j].layerName)) {
59 Logger::logInfo(
string(requiredLayers[i]) +
" is supported!");
61 Logger::logError(
string(requiredLayers[i]) +
" is not supported.");
66 Logger::logInfo(
"Checking Vulkan extensions...");
69 uint32_t availableExtensionCount = 0;
70 vkEnumerateInstanceExtensionProperties(
nullptr, &availableExtensionCount,
nullptr);
73 vector<VkExtensionProperties> availableExtensions(availableExtensionCount);
74 vkEnumerateInstanceExtensionProperties(
nullptr, &availableExtensionCount, availableExtensions.data());
77 uint32_t glfwExtensionCount = 0;
78 const char** glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount);
81 vector<const char*> requiredExtensions(glfwExtensions, glfwExtensions + glfwExtensionCount);
82 requiredExtensions.push_back(VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
85 for (uint32_t i = 0; i < requiredExtensions.size(); i++) {
87 for (uint32_t j = 0; j < availableExtensions.size(); j++) {
88 if (strcmp(requiredExtensions[i], availableExtensions[j].extensionName)) {
94 Logger::logInfo(
string(requiredExtensions[i]) +
" is supported!");
96 Logger::logError(
string(requiredExtensions[i]) +
" is not supported.");
SIMPLEGL_VK_EXPORT void initVK()
Initializes the Vulkan backend, this will also check available extensions and should be called after ...
Generic namespace for the SimpleGL framework.