CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
VKLoader.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
11
13
14#if !CE_PLATFORM_IOS && !CE_PLATFORM_MAC
15#define VK_NO_PROTOTYPES
16#endif
17#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T* object;
18
19#include <vulkan/vulkan.h>
20
21#if CE_PLATFORM_MAC
22#include <vulkan/vulkan_macos.h>
23#elif CE_PLATFORM_IOS
24#include <vulkan/vulkan_ios.h>
25#if defined(VK_MVK_macos_surface) && VK_MVK_macos_surface
26#include <MoltenVK/vk_mvk_moltenvk.h>
27#endif
28#elif CE_PLATFORM_WIN32
29#include <Windows.h>
30#include <vulkan/vulkan_win32.h>
31#endif
32
33#if defined(RenderingCapabilities)
34#undef RenderingCapabilities
35#endif
36
37namespace CeresEngine {
38
39#if !CE_PLATFORM_IOS && !CE_PLATFORM_MAC
40#define CE_VK_FUNCTION(N) extern PFN_vk##N vk##N;
45#if defined(MVK_VERSION)
48#endif
49#include "VKLoader.inc"
50#undef CE_VK_FUNCTION
51#endif
52
54 template<typename T = void> using VKSymbol = DynamicLibrary::Symbol<T>;
55
56 struct VKFuncTable {
59
61 VkDevice device = nullptr;
62
63#define CE_VK_FUNCTION(N) PFN_vk##N N = nullptr;
64#include "VKLoader.inc"
65#undef CE_VK_FUNCTION
66
69
73
78
83
88 };
89
94
98
99} // namespace CeresEngine
#define CE_VK_FUNCTION(N)
Definition VKLoader.hpp:40
Definition DynamicLibrary.hpp:16
Definition Application.hpp:19
void VKLoadVulkan(const DynamicLibrary &dynamicLibrary) noexcept
Loads instance creation function pointers from the Vulkan shared library.
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
A helper structure that provides an implicit conversion operator from a loaded void* function pointer...
Definition DynamicLibrary.hpp:239
Definition VKLoader.hpp:56
VkDevice device
The VkDevice to load pointers for.
Definition VKLoader.hpp:61
VKFuncTable() noexcept=default
Creates an empty VKFuncTable.
VKSymbol forDevice(const char *name) const noexcept
Resolves a symbol by name.
VkInstance instance
The VkInstance to load pointers for.
Definition VKLoader.hpp:58
VKSymbol forInstance(const char *name) const noexcept
Resolves a symbol by name.