//
// Created by Vicente Ferrari Smith on 12.02.26.
//

#ifndef V_INIT_H
#define V_INIT_H

#include <volk/volk.h>
#include <GLFW/glfw3.h>
#include <vma/vk_mem_alloc.h>
#include <vector>

inline VkInstance instance{};
inline VkPhysicalDevice physicalDevice{};
inline VkDevice device{};
inline VkQueue graphics_queue{};
inline uint32_t queueFamily{};

inline VkSurfaceKHR surface{};
inline VkDebugUtilsMessengerEXT debugMessenger{};

inline VmaAllocator allocator{};

inline constexpr uint32_t MAX_FRAMES_IN_FLIGHT = 2;
inline constexpr uint32_t MAX_VERTICES_PER_BATCH = 65536;

inline VkSwapchainKHR swapchain;
inline VkExtent2D swapchain_extent;
inline VkSurfaceFormatKHR swapchain_format{
    VK_FORMAT_B8G8R8A8_UNORM,
    VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
};
inline std::vector<VkSemaphore> renderFinished;

inline std::vector<VkImage> images;
inline std::vector<VkImageView> imageViews;
inline std::vector<VkImageLayout> imageLayouts;

void createSwapchain(GLFWwindow* window);

int createInstance(GLFWwindow* window);
void createSurface(GLFWwindow* window);
void pickPhysicalDevice();
void createDevice();


#endif //V_INIT_H
