RavEngine
Loading...
Searching...
No Matches
Core.hpp
1#pragma once
2#include <memory>
3#include <functional>
4#include <string>
5
6namespace RGL {
7
8 enum class API : uint8_t {
9 Uninitialized, // You didn't call RGL::Init yet
10 PlatformDefault, // RGL will pick an API
11 Noop, // this API does nothing
12 Metal, // Apple Metal
13 Direct3D12, // Microsoft DirectX 12
14 Vulkan, // Vulkan
15 WebGPU // WebGPU (NOT WebGL!)
16 };
17
18 constexpr static API APIsAvailable[] = {
19#if RGL_MTL_AVAILABLE
20 API::Metal,
21#endif
22#if RGL_DX12_AVAILABLE
23 API::Direct3D12,
24#endif
25#if RGL_VK_AVAILABLE
26 API::Vulkan,
27#endif
28#if RGL_WEBGPU_AVAILABLE
29 API::WebGPU,
30#endif
31 API::Noop,
32 };
33
34 bool CanInitAPI(API api);
35 const char* APIToString(API);
36
37 enum class MessageSeverity : uint8_t {
38 Info = 0,
39 Warning,
40 Error,
41 Fatal
42 };
43
44 using callback_t = void(*)(MessageSeverity, const std::string&, void*);
45 using fatal_callback_t = void(*)(const std::string&, void*);
46
47 struct InitOptions {
48 API api = API::PlatformDefault; // what graphics API to use
49 callback_t callback = nullptr; // what function to invoke with debug messages
50 fatal_callback_t fatal_callback = nullptr; // what function to invoke when a non-recoverable error occurs
51 void* callbackUserData = nullptr;
52
53 std::string appName; // Name of your app. Used only on Vulkan.
54 std::string engineName; // Name of your game engine. Used only on Vulkan.
55 struct Version {
56 uint8_t variant = 0;
57 uint8_t major = 0;
58 uint8_t minor = 0;
59 uint8_t patch = 0;
60 } appVersion, // The version number of your app. Used only on Vulkan.
61 engineVersion; // The version number of your engine. Used only on Vulkan.
62 };
63
64 API CurrentAPI();
65
66 void Init(const InitOptions&);
67 void Shutdown();
68
69}
uint8 uint8_t
Definition fwd.hpp:103
Definition Core.hpp:55
Definition Core.hpp:47