Pyrogenesis
HEAD
Pyrogenesis, a RTS Engine
VMA.h
Go to the documentation of this file.
1
/* Copyright (C) 2023 Wildfire Games.
2
* This file is part of 0 A.D.
3
*
4
* 0 A.D. is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* 0 A.D. is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef INCLUDED_RENDERER_BACKEND_VULKAN_VMA
19
#define INCLUDED_RENDERER_BACKEND_VULKAN_VMA
20
21
#include "
lib/debug.h
"
22
#include "
lib/sysdep/os.h
"
23
#include "
ps/CLogger.h
"
24
25
#include <glad/vulkan.h>
26
#include <mutex>
27
28
#define VMA_VULKAN_VERSION 1001000
29
#define VMA_ASSERT(EXPR) ASSERT(EXPR)
30
#define VMA_HEAVY_ASSERT(EXPR) ENSURE(EXPR)
31
#define VMA_DYNAMIC_VULKAN_FUNCTIONS 0
32
#define VMA_STATIC_VULKAN_FUNCTIONS 0
33
#define VMA_BUFFER_DEVICE_ADDRESS 0
34
35
#ifndef NDEBUG
36
#define VMA_DEBUG_LOG(...) do { debug_printf(__VA_ARGS__); debug_printf("\n"
); } while (0)
37
#define VMA_STATS_STRING_ENABLED 1
38
#else
39
#define VMA_DEBUG_LOG(...)
40
#define VMA_STATS_STRING_ENABLED 0
41
#endif
42
43
#if OS_WIN
44
// MSVC doesn't enable std::shared_mutex for XP toolkit.
45
#define VMA_USE_STL_SHARED_MUTEX 0
46
#endif
47
48
#if GCC_VERSION
49
#pragma GCC diagnostic push
50
#pragma GCC diagnostic ignored "-Wformat"
51
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
52
#pragma GCC diagnostic ignored "-Wparentheses"
53
#pragma GCC diagnostic ignored "-Wundef"
54
#pragma GCC diagnostic ignored "-Wunused-parameter"
55
#pragma GCC diagnostic ignored "-Wunused-variable"
56
#endif
57
#if CLANG_VERSION
58
#pragma clang diagnostic push
59
#pragma clang diagnostic ignored "-Wformat"
60
#pragma clang diagnostic ignored "-Wnullability-completeness"
61
#pragma clang diagnostic ignored "-Wparentheses"
62
#pragma clang diagnostic ignored "-Wundef"
63
#pragma clang diagnostic ignored "-Wunused-parameter"
64
#pragma clang diagnostic ignored "-Wunused-variable"
65
#endif
66
#if MSC_VERSION
67
#pragma warning(push, 1)
68
#pragma warning(disable: 4100)
// Unreferenced formal parameter.
69
#pragma warning(disable: 4701)
// Potentially uninitialized local variable used.
70
#pragma warning(disable: 4703)
// Potentially uninitialized local pointer variable used.
71
#endif
72
73
// GCC before 13 doesn't account some diagnostics:
74
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
75
#if GCC_VERSION && !defined(_MSVC_LANG)
76
#define _MSVC_LANG 0
77
#endif
78
79
// VMA always uses extension variants and glad doesn't provide extension
80
// defines and types that were promoted to the core version. So we need to
81
// define them manually.
82
#define PFN_vkBindBufferMemory2KHR PFN_vkBindBufferMemory2
83
#define PFN_vkBindImageMemory2KHR PFN_vkBindImageMemory2
84
#define PFN_vkGetBufferMemoryRequirements2KHR PFN_vkGetBufferMemoryRequirements2
85
#define PFN_vkGetImageMemoryRequirements2KHR PFN_vkGetImageMemoryRequirements2
86
#define PFN_vkGetPhysicalDeviceMemoryProperties2KHR PFN_vkGetPhysicalDeviceMemoryProperties2
87
88
#define vkBindBufferMemory2KHR vkBindBufferMemory2
89
#define vkBindImageMemory2KHR vkBindImageMemory2
90
#define vkGetBufferMemoryRequirements2KHR vkGetBufferMemoryRequirements2
91
#define vkGetImageMemoryRequirements2KHR vkGetImageMemoryRequirements2
92
#define vkGetPhysicalDeviceMemoryProperties2KHR vkGetPhysicalDeviceMemoryProperties2
93
94
#define VkBindBufferMemoryInfoKHR VkBindBufferMemoryInfo
95
#define VkBindImageMemoryInfoKHR VkBindImageMemoryInfo
96
#define VkBufferMemoryRequirementsInfo2KHR VkBufferMemoryRequirementsInfo2
97
#define VkImageMemoryRequirementsInfo2KHR VkImageMemoryRequirementsInfo2
98
#define VkMemoryDedicatedAllocateInfoKHR VkMemoryDedicatedAllocateInfo
99
#define VkMemoryDedicatedRequirementsKHR VkMemoryDedicatedRequirements
100
#define VkMemoryRequirements2KHR VkMemoryRequirements2
101
#define VkPhysicalDeviceMemoryProperties2KHR VkPhysicalDeviceMemoryProperties2
102
103
#define VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO
104
#define VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO
105
#define VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2
106
#define VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2
107
#define VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO
108
#define VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS
109
#define VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2
110
#define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2
111
112
// Those extensions should be enabled automatically by picking Vulkan 1.1.
113
#define VK_AMD_device_coherent_memory 0
114
#define VK_KHR_bind_memory2 0
115
#define VK_KHR_get_memory_requirements2 0
116
#define VK_KHR_external_memory 0
117
#define VK_EXT_memory_budget 0
118
#define VK_EXT_memory_priority 0
119
120
#include "third_party/vma/vk_mem_alloc.h"
121
122
#if GCC_VERSION
123
#pragma GCC diagnostic pop
124
#endif
125
#if CLANG_VERSION
126
#pragma clang diagnostic pop
127
#endif
128
#if MSC_VERSION
129
#pragma warning(pop)
130
#endif
131
132
#endif
// INCLUDED_RENDERER_BACKEND_VULKAN_VMA
CLogger.h
debug.h
os.h
source
renderer
backend
vulkan
VMA.h
Generated by
1.9.4