forked from malte-v/VulkanMemoryAllocator-Hpp
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathCompileCheck.cpp
More file actions
122 lines (109 loc) · 3.96 KB
/
CompileCheck.cpp
File metadata and controls
122 lines (109 loc) · 3.96 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#include "common.hpp"
void checkEnums() {
static_assert(vk::FlagTraits<vma::AllocationCreateFlagBits>::isBitmask, "FlagTraits specialization is not visible");
constexpr auto flag = static_cast<vma::AllocationCreateFlagBits>(0);
auto flags = flag | flag;
flags = flag | flags;
flags = flags | flag;
flags = flags | flags;
static_assert(vk::FlagTraits<vma::AllocationCreateFlagBits>::allFlags, "FlagTraits::allFlags is not visible");
flags = ~flag;
flags = ~flags;
const auto fl = flag, fr = flag;
const auto fsl = flags, fsr = flags;
if (fl < fr) throw;
if (fl < fsr) throw;
if (fsl < fr) throw;
if (fsl < fsr) throw;
if (fl > fr) throw;
if (fl > fsr) throw;
if (fsl > fr) throw;
if (fsl > fsr) throw;
if (fl <= fr) {}
if (fl <= fsr) {}
if (fsl <= fr) {}
if (fsl <= fsr) {}
if (fl >= fr) {}
if (fl >= fsr) {}
if (fsl >= fr) {}
if (fsl >= fsr) {}
if (fl == fr) {}
if (fl == fsr) {}
if (fsl == fr) {}
if (fsl == fsr) {}
if (fl != fr) throw;
if (fl != fsr) throw;
if (fsl != fr) throw;
if (fsl != fsr) throw;
#ifndef VULKAN_HPP_NO_TO_STRING
to_string(flag);
to_string(flags);
#endif
}
void checkStructs() {
vma::VulkanFunctions functions = vma::functionsFromDispatcher();
functions = vma::functionsFromDispatcher(vk::detail::DispatchLoaderDynamic {});
#if !defined( VK_NO_PROTOTYPES )
functions = vma::functionsFromDispatcher(vk::detail::DispatchLoaderStatic {});
#endif
functions = vma::VulkanFunctions { nullptr };
functions.setVkGetInstanceProcAddr(nullptr);
functions.vkGetInstanceProcAddr = nullptr;
if (vma::DeviceMemoryCallbacks {} != vma::DeviceMemoryCallbacks {}) throw;
if (vma::VulkanFunctions {} != vma::VulkanFunctions {}) throw;
if (vma::AllocatorCreateInfo {} != vma::AllocatorCreateInfo {}) throw;
if (vma::AllocatorInfo {} != vma::AllocatorInfo {}) throw;
if (vma::Statistics {} != vma::Statistics {}) throw;
if (vma::DetailedStatistics {} != vma::DetailedStatistics {}) throw;
if (vma::TotalStatistics {} != vma::TotalStatistics {}) throw;
if (vma::Budget {} != vma::Budget {}) throw;
if (vma::AllocationCreateInfo {} != vma::AllocationCreateInfo {}) throw;
if (vma::PoolCreateInfo {} != vma::PoolCreateInfo {}) throw;
if (vma::AllocationInfo {} != vma::AllocationInfo {}) throw;
if (vma::AllocationInfo2 {} != vma::AllocationInfo2 {}) throw;
if (vma::DefragmentationInfo {} != vma::DefragmentationInfo {}) throw;
if (vma::DefragmentationMove {} != vma::DefragmentationMove {}) throw;
if (vma::DefragmentationPassMoveInfo {} != vma::DefragmentationPassMoveInfo {}) throw;
if (vma::DefragmentationStats {} != vma::DefragmentationStats {}) throw;
if (vma::VirtualBlockCreateInfo {} != vma::VirtualBlockCreateInfo {}) throw;
if (vma::VirtualAllocationCreateInfo {} != vma::VirtualAllocationCreateInfo {}) throw;
if (vma::VirtualAllocationInfo {} != vma::VirtualAllocationInfo {}) throw;
// Enhanced.
vma::DefragmentationMove moves[1];
vma::DefragmentationPassMoveInfo moveInfo { moves };
moveInfo.setMoves(moves);
}
void checkHandles() {
vma::Allocator allocator;
allocator = nullptr;
allocator = VK_NULL_HANDLE;
if (allocator) throw;
if (!allocator) {}
if (allocator == nullptr) {}
if (nullptr == allocator) {}
if (allocator != nullptr) throw;
if (nullptr != allocator) throw;
const auto al = allocator, ar = allocator;
if (al > ar) throw;
if (al < ar) throw;
if (al >= ar) {}
if (al <= ar) {}
if (al == ar) {}
if (al != ar) throw;
#ifndef VULKAN_HPP_NO_SMART_HANDLE
vma::UniqueAllocator unique;
vma::UniqueBuffer buffer;
#endif
vma::raii::Allocator raii = nullptr;
allocator = raii;
allocator = *raii;
const auto &rl = raii, &rr = raii;
if (rl == rr) {}
if (rl != rr) throw;
}
int main(int, char**) {
checkEnums();
checkStructs();
checkHandles();
return 0;
}