blob: 4ee04dbc80dbe528156163d4b1adc40d6d1d00b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// vk-module.h
#pragma once
#include "slang-com-helper.h"
#include "slang.h"
#if SLANG_WINDOWS_FAMILY
#define VK_USE_PLATFORM_WIN32_KHR 1
#elif SLANG_APPLE_FAMILY
#define VK_USE_PLATFORM_METAL_EXT 1
#else
#if SLANG_ENABLE_XLIB
#define VK_USE_PLATFORM_XLIB_KHR 1
#endif
#endif
#define VK_NO_PROTOTYPES
#include <vulkan/vulkan.h>
// Undef xlib macros
#ifdef Always
#undef Always
#endif
#ifdef None
#undef None
#endif
namespace gfx
{
struct VulkanModule
{
/// true if has been initialized
SLANG_FORCE_INLINE bool isInitialized() const { return m_module != nullptr; }
/// Get a function by name
PFN_vkVoidFunction getFunction(const char* name) const;
/// true if using a software Vulkan implementation.
bool isSoftware() const { return m_isSoftware; }
/// Initialize
Slang::Result init(bool useSoftwareImpl);
/// Destroy
void destroy();
/// Dtor
~VulkanModule() { destroy(); }
protected:
void* m_module = nullptr;
bool m_isSoftware = false;
};
} // namespace gfx
|