Lluvia
MemoryPropertyFlags.h
Go to the documentation of this file.
1 
8 #ifndef LLUVIA_CORE_MEMORY_MEMORY_PROPERTY_FLAGS_H_
9 #define LLUVIA_CORE_MEMORY_MEMORY_PROPERTY_FLAGS_H_
10 
11 #include <cstdint>
12 
15 
16 namespace ll {
17 
19  DeviceLocal = static_cast<ll::enum_t>(vk::MemoryPropertyFlagBits::eDeviceLocal),
20  HostVisible = static_cast<ll::enum_t>(vk::MemoryPropertyFlagBits::eHostVisible),
21  HostCoherent = static_cast<ll::enum_t>(vk::MemoryPropertyFlagBits::eHostCoherent),
22  HostCached = static_cast<ll::enum_t>(vk::MemoryPropertyFlagBits::eHostCached)
23 };
24 
26 
28 {
29  return MemoryPropertyFlags(bit0) | bit1;
30 }
31 
33 {
34  return MemoryPropertyFlags(bit0) & bit1;
35 }
36 
38 {
39  return MemoryPropertyFlags(bit0) ^ bit1;
40 }
41 
42 // inline constexpr MemoryPropertyFlags operator~(MemoryPropertyFlagBits bits) noexcept
43 // {
44 // return ~(MemoryPropertyFlags(bits));
45 // }
46 
47 namespace impl {
48 
50  {
51  return ll::MemoryPropertyFlags {static_cast<ll::enum_t>(flags)};
52  }
53 
59  constexpr const std::array<std::tuple<const char*, ll::MemoryPropertyFlagBits>, 4> MemoryPropertyFlagBitsStrings {{std::make_tuple("DeviceLocal", ll::MemoryPropertyFlagBits::DeviceLocal),
60  std::make_tuple("HostCached", ll::MemoryPropertyFlagBits::HostCached),
61  std::make_tuple("HostCoherent", ll::MemoryPropertyFlagBits::HostCoherent),
62  std::make_tuple("HostVisible", ll::MemoryPropertyFlagBits::HostVisible)}};
63 
64 } // namespace impl
65 
78 inline ll::MemoryPropertyFlags vectorStringToMemoryPropertyFlags(const std::vector<std::string>& flagsVector) noexcept
79 {
81 }
82 
92 inline std::vector<std::string> memoryPropertyFlagsToVectorString(const ll::MemoryPropertyFlags flags) noexcept
93 {
95 }
96 
97 } // namespace ll
98 
99 #endif // LLUVIA_CORE_MEMORY_MEMORY_PROPERTY_FLAGS_H_
Enums.
constexpr ll::MemoryPropertyFlags fromVkMemoryPropertyFlags(const vk::MemoryPropertyFlags &flags) noexcept
Definition: MemoryPropertyFlags.h:49
constexpr const std::array< std::tuple< const char *, ll::MemoryPropertyFlagBits >, 4 > MemoryPropertyFlagBitsStrings
Definition: MemoryPropertyFlags.h:59
E vectorStringToFlags(const std::vector< std::string > &flagsVector) noexcept
Definition: enums.h:191
std::vector< std::string > flagsToVectorString(E flags) noexcept
Definition: enums.h:211
Definition: Buffer.h:28
std::vector< std::string > memoryPropertyFlagsToVectorString(const ll::MemoryPropertyFlags flags) noexcept
Converts from Vulkan MemoryPropertyFlags to a vector of strings.
Definition: MemoryPropertyFlags.h:92
ll::Flags< MemoryPropertyFlagBits, ll::enum_t > MemoryPropertyFlags
Definition: MemoryPropertyFlags.h:25
constexpr BufferUsageFlags operator^(BufferUsageFlagBits bit0, BufferUsageFlagBits bit1) noexcept
Definition: BufferUsageFlags.h:35
constexpr BufferUsageFlags operator|(BufferUsageFlagBits bit0, BufferUsageFlagBits bit1) noexcept
Definition: BufferUsageFlags.h:25
constexpr BufferUsageFlags operator&(BufferUsageFlagBits bit0, BufferUsageFlagBits bit1) noexcept
Definition: BufferUsageFlags.h:30
MemoryPropertyFlagBits
Definition: MemoryPropertyFlags.h:18
uint32_t enum_t
Definition: enums.h:23
ll::MemoryPropertyFlags vectorStringToMemoryPropertyFlags(const std::vector< std::string > &flagsVector) noexcept
Converts from a string vector to Vulkan MemoryPropertyFlags.
Definition: MemoryPropertyFlags.h:78