From dce67620b95a9555c7db950196b22f1bb88a307b Mon Sep 17 00:00:00 2001 From: hachem Date: Wed, 19 Aug 2026 20:33:30 +0200 Subject: feat: vulkan is going to be the end of me bro --- src/core/window.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/core/window.cpp') diff --git a/src/core/window.cpp b/src/core/window.cpp index cb93d04..0a9ac8b 100644 --- a/src/core/window.cpp +++ b/src/core/window.cpp @@ -1,6 +1,7 @@ #include #include "window.h" #include "theme_manager.h" +#include "rendering/renderer.h" #include @@ -42,12 +43,19 @@ namespace Donut DONUT_INFO("GLFW initialized successfully"); } + if (RendererAPI::get_api() == RendererAPI::API::Vulkan) + { + glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); + } + else + { #ifdef __APPLE__ - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); - glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); - glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); #endif + } m_window = glfwCreateWindow(m_width, m_height, m_title.c_str(), nullptr, nullptr); if (!m_window) @@ -59,7 +67,8 @@ namespace Donut DONUT_INFO("GLFW window created successfully"); - glfwMakeContextCurrent(m_window); + if (RendererAPI::get_api() != RendererAPI::API::Vulkan) + glfwMakeContextCurrent(m_window); glfwSetWindowUserPointer(m_window, this); glfwSetErrorCallback(glfw_error_callback); @@ -96,7 +105,8 @@ namespace Donut void Window::on_update() const { glfwPollEvents(); - glfwSwapBuffers(m_window); + if (RendererAPI::get_api() != RendererAPI::API::Vulkan) + glfwSwapBuffers(m_window); } bool Window::should_close() const @@ -208,7 +218,7 @@ namespace Donut void Window::glfw_error_callback(int error, const char* description) { - DONUT_ERROR("GLFW Error (", error, "): ", description); + DONUT_ERROR("GLFW Error ({}): {}", error, description ? description : ""); } void Window::glfw_window_close_callback(GLFWwindow* window) -- cgit v1.3