#include <Vk/Surface/Surface.hpp>
#include <Utilities/Utilities.hpp>

Vk::Surface::Surface(SDL_Window *window, std::shared_ptr<Vk::Instance> instance) : m_instance(instance)
{
    if (!SDL_Vulkan_CreateSurface(window, instance->inner(), nullptr, &m_surface))
    {
        crash("Failed to create the window surface!");
    }
}

Vk::Surface::~Surface()
{
    vkDestroySurfaceKHR(m_instance->inner(), m_surface, nullptr);
}

VkSurfaceKHR Vk::Surface::inner()
{
    return m_surface;
}