diff options
| -rw-r--r-- | main.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -21,9 +21,7 @@ class HelloTriangleApplication { public: void run() { - std::cout << "enableValidationLayers = " << enableValidationLayers << std::endl; - initWindow(); initVulkan(); mainLoop(); @@ -118,6 +116,7 @@ private: window = glfwCreateWindow(WIDTH, HEIGHT, "Vulkan", nullptr, nullptr); glfwSetWindowUserPointer(window, this); glfwSetKeyCallback(window, key_callback); + glfwSetWindowPos(window, 1000, 1000); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) @@ -147,8 +146,6 @@ private: return VK_FALSE; } - - void initVulkan() { createInstance(); // 01 Setup -> Instance setupDebugMessenger(); // 02 Setup -> Validation Layers @@ -767,12 +764,15 @@ private: checkSucc("CREATE INSTANCE", vkCreateInstance(&createInfo, nullptr, &instance)); } - // O(n^2) + // instance validation layers apply to all Vulkan calls (enble on device level for compat) bool checkValidationLayerSupport() { uint32_t layerCount; vkEnumerateInstanceLayerProperties(&layerCount, nullptr); std::vector<VkLayerProperties> availableLayers(layerCount); vkEnumerateInstanceLayerProperties(&layerCount, availableLayers.data()); + + std::set<std::string> requiredLayers(validationLayers.begin(), validationLayers.end()); + for (const char* layerName : validationLayers) { bool layerFound = false; @@ -786,6 +786,14 @@ private: } } return true; +/* + for (const auto& extension : availableExtensions) { + // std::cout << "Available Device Extension: " << extension.extensionName << std::endl; + requiredExtensions.erase(extension.extensionName); + } + + return requiredExtensions.empty(); + */ } std::vector<const char*> getRequiredExtensions() { @@ -955,8 +963,8 @@ private: DestroyDebugUtilsMessengerEXT(instance, debugMessenger, nullptr); } vkDestroySurfaceKHR(instance, surface, nullptr); - vkDestroyInstance(instance, nullptr); + vkDestroyInstance(instance, nullptr); glfwDestroyWindow(window); glfwTerminate(); } |
