mirror of
https://github.com/rt64/rt64.git
synced 2025-01-04 02:50:36 +00:00
29 lines
989 B
C++
29 lines
989 B
C++
#include "rhi/rt64_render_interface.h"
|
|
|
|
namespace RT64 {
|
|
extern std::unique_ptr<RenderInterface> CreateD3D12Interface();
|
|
extern std::unique_ptr<RenderInterface> CreateVulkanInterface();
|
|
extern std::unique_ptr<RenderInterface> CreateMetalInterface();
|
|
}
|
|
|
|
std::unique_ptr<RT64::RenderInterface> CreateRenderInterface() {
|
|
#if defined(_WIN32)
|
|
const bool useVulkan = true; // Or derive this from configuration or runtime check.
|
|
if (!useVulkan) {
|
|
return RT64::CreateD3D12Interface();
|
|
}
|
|
// Fallback to Vulkan if D3D12 is not chosen or available.
|
|
return RT64::CreateVulkanInterface();
|
|
#elif defined(__APPLE__)
|
|
return RT64::CreateMetalInterface();
|
|
#else
|
|
return RT64::CreateVulkanInterface();
|
|
#endif
|
|
}
|
|
|
|
int main(int argc, char** argv) {
|
|
auto renderInterface = CreateRenderInterface();
|
|
// Execute a blocking test that creates a window and draws some geometry to test the render interface.
|
|
RT64::RenderInterfaceTest(renderInterface.get());
|
|
}
|