diff --git a/src/Magnum/Platform/GlfwApplication.cpp b/src/Magnum/Platform/GlfwApplication.cpp index 65e1d7780..01871dd0f 100644 --- a/src/Magnum/Platform/GlfwApplication.cpp +++ b/src/Magnum/Platform/GlfwApplication.cpp @@ -33,6 +33,10 @@ #include "Magnum/Platform/Context.h" #include "Magnum/Platform/ScreenedApplication.hpp" +#ifdef MAGNUM_TARGET_VULKAN +#include "Magnum/Vk/Context.h" +#endif + namespace Magnum { namespace Platform { GlfwApplication* GlfwApplication::_instance = nullptr; @@ -237,6 +241,19 @@ void GlfwApplication::mouseReleaseEvent(MouseEvent&) {} void GlfwApplication::mouseMoveEvent(MouseMoveEvent&) {} void GlfwApplication::mouseScrollEvent(MouseScrollEvent&) {} +#ifdef MAGNUM_TARGET_VULKAN +VkSurfaceKHR GlfwApplication::createVkSurface() { + VkSurfaceKHR surface; + + VkResult res = glfwCreateWindowSurface(Magnum::Vk::Context::current().vkInstance(), _window, nullptr, &surface); + if(res != VK_SUCCESS) { + Error() << "Vulkan Surface creation failed."; + } + + return surface; +} +#endif + GlfwApplication::Configuration::Configuration(): _title{"Magnum GLFW Application"}, _size{800, 600}, _sampleCount{0}, diff --git a/src/Magnum/Platform/GlfwApplication.h b/src/Magnum/Platform/GlfwApplication.h index 8613213f5..4e6d17bec 100644 --- a/src/Magnum/Platform/GlfwApplication.h +++ b/src/Magnum/Platform/GlfwApplication.h @@ -40,6 +40,10 @@ /* We must include our own GL headers first to avoid conflicts */ #include "Magnum/OpenGL.h" +#ifdef MAGNUM_TARGET_VULKAN +#include "vulkan.h" +#endif + #include namespace Magnum { namespace Platform { @@ -240,6 +244,10 @@ class GlfwApplication { /*@}*/ + #ifdef MAGNUM_TARGET_VULKAN + VkSurfaceKHR createVkSurface(); + #endif + private: static void staticViewportEvent(GLFWwindow*, int w, int h) { _instance->viewportEvent({w, h});