VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
graphicsDeviceCreate.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// Created by Arnis Lektauers on 05.09.2025.
5//
7
8#ifdef VISUTWIN_HAS_METAL
10#endif
11
12#ifdef VISUTWIN_HAS_VULKAN
14#endif
15
16#include "spdlog/spdlog.h"
17
18namespace visutwin::canvas
19{
20 std::unique_ptr<GraphicsDevice> createGraphicsDevice(const GraphicsDeviceOptions& options)
21 {
22 switch (options.backend)
23 {
24 case Backend::Metal:
25#ifdef VISUTWIN_HAS_METAL
26 return std::make_unique<MetalGraphicsDevice>(options);
27#else
28 spdlog::error("Metal backend not available on this platform");
29 return nullptr;
30#endif
31 case Backend::Vulkan:
32#ifdef VISUTWIN_HAS_VULKAN
33 return std::make_unique<VulkanGraphicsDevice>(options);
34#else
35 spdlog::error("Vulkan backend not available on this platform");
36 return nullptr;
37#endif
38 default:
39 spdlog::error("Unknown backend: {}", static_cast<int>(options.backend));
40 return nullptr;
41 }
42 }
43}
std::unique_ptr< GraphicsDevice > createGraphicsDevice(const GraphicsDeviceOptions &options)