#include <Vk/Semaphore/Semaphore.hpp>
#include <Vk/Device/Device.hpp>
#include <Utilities/Utilities.hpp>

Vk::Semaphore::Semaphore(std::shared_ptr<Vk::Device> device) : m_device(device)
{
    VkSemaphoreCreateInfo semaphoreInfo{};
    semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;

    if (vkCreateSemaphore(device->inner(), &semaphoreInfo, nullptr, &m_semaphore) != VK_SUCCESS)
    {
        crash("Failed to create a Vulkan semaphore!");
    }
}

Vk::Semaphore::~Semaphore()
{
    vkDestroySemaphore(m_device->inner(), m_semaphore, nullptr);
}

VkSemaphore Vk::Semaphore::inner()
{
    return m_semaphore;
}