Debian Codegraph @

Source/Core/VideoBackends/Vulkan/VulkanLoader.h

raw symbols SCIP
1 // Copyright 2016 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #define VK_NO_PROTOTYPES
7
8 #if defined(_WIN32)
9 #define VK_USE_PLATFORM_WIN32_KHR
10 #endif
11
12 #if defined(HAVE_X11)
13 #define VK_USE_PLATFORM_XLIB_KHR
14 #endif
15
16 #if defined(ANDROID)
17 #define VK_USE_PLATFORM_ANDROID_KHR
18 #endif
19
20 #if defined(__APPLE__)
21 #define VK_USE_PLATFORM_METAL_EXT
22 #endif
23
24 #include "vulkan/vulkan.h"
25
26 #ifdef ANDROID
27 #include <unistd.h>
28 #endif
29
30 // Currently, exclusive fullscreen is only supported on Windows.
31 #if defined(WIN32)
32 #define SUPPORTS_VULKAN_EXCLUSIVE_FULLSCREEN 1
33 #endif
34
35 // We abuse the preprocessor here to only need to specify function names once.
36 #define VULKAN_MODULE_ENTRY_POINT(name, required) extern PFN_##name name;
37 #define VULKAN_INSTANCE_ENTRY_POINT(name, required) extern PFN_##name name;
38 #define VULKAN_DEVICE_ENTRY_POINT(name, required) extern PFN_##name name;
39 #include "VideoBackends/Vulkan/VulkanEntryPoints.inl"
40 #undef VULKAN_DEVICE_ENTRY_POINT
41 #undef VULKAN_INSTANCE_ENTRY_POINT
42 #undef VULKAN_MODULE_ENTRY_POINT
43
44 // Include vma allocator globally since including it before the vulkan headers causes
45 // errors
46 #ifdef _MSVC_LANG
47 #pragma warning(push, 4)
48 #pragma warning(disable : 4189) // local variable is initialized but not referenced
49 #pragma warning(disable : 4505) // function with internal linkage is not referenced
50
51 #endif // #ifdef _MSVC_LANG
52
53 #ifdef __clang__
54 #pragma clang diagnostic push
55 #pragma clang diagnostic ignored "-Wunused-variable"
56 #pragma clang diagnostic ignored "-Wunused-function"
57 #pragma clang diagnostic ignored "-Wnullability-completeness"
58 #endif // #ifdef __clang__
59
60 #ifdef __GNUC__
61 #pragma GCC diagnostic push
62 #pragma GCC diagnostic ignored "-Wunused-variable"
63 #pragma GCC diagnostic ignored "-Wunused-function"
64 #endif // #ifdef __GNUC__
65
66 #define VMA_VULKAN_VERSION 1002000
67 #define VMA_STATIC_VULKAN_FUNCTIONS 1
68 #define VMA_DYNAMIC_VULKAN_FUNCTIONS 0
69 #undef VK_NO_PROTOTYPES
70 #include "vk_mem_alloc.h"
71
72 #ifdef _MSVC_LANG
73 #pragma warning(pop)
74 #endif // #ifdef _MSVC_LANG
75
76 #ifdef __clang__
77 #pragma clang diagnostic pop
78 #endif // #ifdef __clang__
79
80 #ifdef __GNUC__
81 #pragma GCC diagnostic pop
82 #endif // #ifdef __GNUC__
83
84 #include "Common/Logging/Log.h"
85
86 namespace Vulkan
87 {
88 bool LoadVulkanLibrary(bool force_system_library = false);
89 bool LoadVulkanInstanceFunctions(VkInstance instance);
90 bool LoadVulkanDeviceFunctions(VkDevice device);
91 void UnloadVulkanLibrary();
92
93 #ifdef ANDROID
94 bool SupportsCustomDriver();
95 #endif
96
97 const char* VkResultToString(VkResult res);
98 void LogVulkanResult(Common::Log::LogLevel level, const char* func_name, const int line,
99 VkResult res, const char* msg);
100
101 #define LOG_VULKAN_ERROR(res, msg) \
102 LogVulkanResult(Common::Log::LogLevel::LERROR, __func__, __LINE__, res, msg)
103
104 } // namespace Vulkan