diff --git a/oatmeal/src/ctx.h b/oatmeal/src/ctx.h index 70e9209..d1ac7fd 100644 --- a/oatmeal/src/ctx.h +++ b/oatmeal/src/ctx.h @@ -46,6 +46,8 @@ namespace Oatmeal { private: // Members // + GLFWwindow *m_window = nullptr; + vk::raii::Context m_context; vk::raii::Instance m_instance = nullptr; vk::DebugUtilsMessengerEXT m_debugMessenger = nullptr; @@ -81,5 +83,9 @@ namespace Oatmeal { void createInstance(); std::vector getRequiredExtensions(); void setupDebugMessenger(); + void createSurface(); + void pickPhysicalDevice(); + bool isPhysicalDeviceSupported(vk::raii::PhysicalDevice device); + uint32_t scorePhysicalDevice(vk::raii::PhysicalDevice device); }; } // namespace Oatmeal diff --git a/oatmeal/src/ctx_instance.cpp b/oatmeal/src/ctx_instance.cpp index 00feb50..aca18b8 100644 --- a/oatmeal/src/ctx_instance.cpp +++ b/oatmeal/src/ctx_instance.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include diff --git a/oatmeal/src/ctx_surface.cpp b/oatmeal/src/ctx_surface.cpp new file mode 100644 index 0000000..89119e4 --- /dev/null +++ b/oatmeal/src/ctx_surface.cpp @@ -0,0 +1,18 @@ +#include "ctx.h" + +#include +#include +#include +#include + + +namespace Oatmeal { + + void ctx::createSurface() { + VkSurfaceKHR _surface; + if (glfwCreateWindowSurface(*m_instance, m_window, nullptr, &_surface)) { + throw std::runtime_error("Failed to create window surface"); + } + m_surface = vk::raii::SurfaceKHR(m_instance, _surface); + } +} // namespace Oatmeal