#include "renderer/common/render_mesh.h"
#include "renderer/common/renderer_api.h"

#include "device.hpp"

rt_result Dx11Init(const rt_renderer_init_info *info) {
    rt_result res = rt_dx11_device::GetInstance()->Initialize(info);
    if (res != RT_SUCCESS)
        return res;

    res = rtInitMeshStreaming();
    return res;
}

void Dx11Shutdown(void) {
    rtShutdownMeshStreaming();
    rt_dx11_device::GetInstance()->Shutdown();
}

// Called by the application to retrieve the renderer api
extern "C" RT_DLLEXPORT rt_renderer_api rtLoadRendererImpl(void) {
    rt_renderer_api api = {
        .Init     = Dx11Init,
        .Shutdown = Dx11Shutdown,
    };
    return api;
}
