#include <vulkan/vulkan.h>

VkFormat GetVulkanFormat(texture_format format) {
    switch (format) {
        // 8-bit formats
        case texture_format::R8_UNORM:
            return VK_FORMAT_R8_UNORM;
        case texture_format::R8_SNORM:
            return VK_FORMAT_R8_SNORM;
        case texture_format::R8_UINT:
            return VK_FORMAT_R8_UINT;
        case texture_format::R8_SINT:
            return VK_FORMAT_R8_SINT;

        // 16-bit formats
        case texture_format::RG8_UNORM:
            return VK_FORMAT_R8G8_UNORM;
        case texture_format::RG8_SNORM:
            return VK_FORMAT_R8G8_SNORM;
        case texture_format::RG8_UINT:
            return VK_FORMAT_R8G8_UINT;
        case texture_format::RG8_SINT:
            return VK_FORMAT_R8G8_SINT;

        // 24-bit formats
        case texture_format::RGB8_UNORM:
            return VK_FORMAT_R8G8B8_UNORM;
        case texture_format::RGB8_SNORM:
            return VK_FORMAT_R8G8B8_SNORM;
        case texture_format::RGB8_UINT:
            return VK_FORMAT_R8G8B8_UINT;
        case texture_format::RGB8_SINT:
            return VK_FORMAT_R8G8B8_SINT;

        // 32-bit formats
        case texture_format::RGBA8_UNORM:
            return VK_FORMAT_R8G8B8A8_UNORM;
        case texture_format::RGBA8_SNORM:
            return VK_FORMAT_R8G8B8A8_SNORM;
        case texture_format::RGBA8_UINT:
            return VK_FORMAT_R8G8B8A8_UINT;
        case texture_format::RGBA8_SINT:
            return VK_FORMAT_R8G8B8A8_SINT;

        // SRGB formats
        case texture_format::SRGB8:
            return VK_FORMAT_R8G8B8_SRGB;
        case texture_format::SRGB8_ALPHA8:
            return VK_FORMAT_R8G8B8A8_SRGB;

        // 16-bit float formats
        case texture_format::R16_FLOAT:
            return VK_FORMAT_R16_SFLOAT;
        case texture_format::RG16_FLOAT:
            return VK_FORMAT_R16G16_SFLOAT;
        case texture_format::RGB16_FLOAT:
            return VK_FORMAT_R16G16B16_SFLOAT;
        case texture_format::RGBA16_FLOAT:
            return VK_FORMAT_R16G16B16A16_SFLOAT;

        // 32-bit float formats
        case texture_format::R32_FLOAT:
            return VK_FORMAT_R32_SFLOAT;
        case texture_format::RG32_FLOAT:
            return VK_FORMAT_R32G32_SFLOAT;
        case texture_format::RGB32_FLOAT:
            return VK_FORMAT_R32G32B32_SFLOAT;
        case texture_format::RGBA32_FLOAT:
            return VK_FORMAT_R32G32B32A32_SFLOAT;

        // Integer formats
        case texture_format::R16_UINT:
            return VK_FORMAT_R16_UINT;
        case texture_format::R16_SINT:
            return VK_FORMAT_R16_SINT;
        case texture_format::RG16_UINT:
            return VK_FORMAT_R16G16_UINT;
        case texture_format::RG16_SINT:
            return VK_FORMAT_R16G16_SINT;
        case texture_format::RGBA16_UINT:
            return VK_FORMAT_R16G16B16A16_UINT;
        case texture_format::RGBA16_SINT:
            return VK_FORMAT_R16G16B16A16_SINT;
        case texture_format::R32_UINT:
            return VK_FORMAT_R32_UINT;
        case texture_format::R32_SINT:
            return VK_FORMAT_R32_SINT;
        case texture_format::RG32_UINT:
            return VK_FORMAT_R32G32_UINT;
        case texture_format::RG32_SINT:
            return VK_FORMAT_R32G32_SINT;
        case texture_format::RGBA32_UINT:
            return VK_FORMAT_R32G32B32A32_UINT;
        case texture_format::RGBA32_SINT:
            return VK_FORMAT_R32G32B32A32_SINT;

        // Depth/stencil formats
        case texture_format::D16_UNORM:
            return VK_FORMAT_D16_UNORM;
        case texture_format::D24_UNORM_S8_UINT:
            return VK_FORMAT_D24_UNORM_S8_UINT;
        case texture_format::D32_FLOAT:
            return VK_FORMAT_D32_SFLOAT;
        case texture_format::D32_FLOAT_S8X24_UINT:
            return VK_FORMAT_D32_SFLOAT_S8_UINT;

        // Compressed formats
        case texture_format::BC1_UNORM:
            return VK_FORMAT_BC1_RGB_UNORM_BLOCK;
        case texture_format::BC3_UNORM:
            return VK_FORMAT_BC3_UNORM_BLOCK;
        
        default:
            return VK_FORMAT_UNDEFINED; // Unsupported format
    }
}
