#include <extra2d/graphics/backends/vulkan/vk_renderer.h>
#include <extra2d/graphics/backends/backend_factory.h>

namespace extra2d {
namespace graphics {

namespace {
    static bool s_vulkanBackendRegistered = false;
}

/**
 * @brief 初始化 Vulkan 后端注册
 */
void initVulkanBackend() {
    if (s_vulkanBackendRegistered) {
        return;
    }
    s_vulkanBackendRegistered = true;
    
    BackendFactory::reg(
        "vulkan",
        []() -> UniquePtr<RenderBackend> { 
            return makeUnique<VulkanRenderer>(); 
        },
        {"sdl2", "glfw"}
    );
}

namespace {
    struct VulkanBackendAutoReg {
        VulkanBackendAutoReg() {
            initVulkanBackend();
        }
    };
    static VulkanBackendAutoReg s_vulkanAutoReg;
}

} // namespace graphics
} // namespace extra2d
