summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2025-01-09 18:31:18 +0100
committerMiguel <m.i@gmx.at>2025-01-09 18:31:18 +0100
commit5a2cba2a816fa36081e02d6932ed875764a5e3d4 (patch)
treee39893da11891965ee7f2e7ada9c2a82676a5de3 /main.cpp
parent2c41b643607f2f717824a035eafde5a89340fed5 (diff)
next
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/main.cpp b/main.cpp
index c0d9997..e7ae44a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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();
}