Lluvia
PortType.h
Go to the documentation of this file.
1 
8 #ifndef LLUVIA_CORE_NODE_PORT_TYPE_H_
9 #define LLUVIA_CORE_NODE_PORT_TYPE_H_
10 
13 
14 namespace ll {
15 
21 enum class PortType : ll::enum_t {
22  Buffer = 0,
23  ImageView = 1,
24  SampledImageView = 2,
25  UniformBuffer = 3,
26 };
27 
28 namespace impl {
29 
35  constexpr const std::array<std::tuple<const char*, ll::PortType>, 4> PortTypeStrings {{
36  std::make_tuple("Buffer", ll::PortType::Buffer),
37  std::make_tuple("ImageView", ll::PortType::ImageView),
38  std::make_tuple("SampledImageView", ll::PortType::SampledImageView),
39  std::make_tuple("UniformBuffer", ll::PortType::UniformBuffer),
40  }};
41 
42 } // namespace impl
43 
53 template <typename T = std::string>
54 inline T portTypeToString(ll::PortType&& value) noexcept
55 {
56  return ll::impl::enumToString<ll::PortType, ll::impl::PortTypeStrings.size(), impl::PortTypeStrings>(std::forward<ll::PortType>(value));
57 }
58 
59 template <typename T = std::string>
60 inline T portTypeToString(const ll::PortType& value) noexcept
61 {
63 }
64 
72 vk::DescriptorType portTypeToVkDescriptorType(const ll::PortType& param);
73 
85 ll::PortType vkDescriptorTypeToPortType(const vk::DescriptorType& vkDescType);
86 
98 template <typename T>
99 inline ll::PortType stringToPortType(T&& stringValue)
100 {
101  return impl::stringToEnum<ll::PortType, T, ll::impl::PortTypeStrings.size(), impl::PortTypeStrings>(std::forward<T>(stringValue));
102 }
103 
104 } // namespace ll
105 
106 #endif // LLUVIA_CORE_NODE_PORT_TYPE_H_
Objects to manage raw portions of allocated memory.
Definition: Buffer.h:57
Represents portions of a ll::Image to be sent as parameter to a GLSL shader.
Definition: ImageView.h:149
Enums.
constexpr const std::array< std::tuple< const char *, ll::PortType >, 4 > PortTypeStrings
Port type string values used for converting ll::PortType to std::string and vice-versa.
Definition: PortType.h:35
E stringToEnum(T &&stringValue)
Definition: enums.h:172
std::string enumToString(E &&value) noexcept
Definition: enums.h:146
Definition: Buffer.h:28
ll::PortType stringToPortType(T &&stringValue)
Converts from a string-like object to ll::PortType enum.
Definition: PortType.h:99
ll::PortType vkDescriptorTypeToPortType(const vk::DescriptorType &vkDescType)
Converts from Vulkan DescriptorType to ll::PortType enum.
PortType
Port types.
Definition: PortType.h:21
vk::DescriptorType portTypeToVkDescriptorType(const ll::PortType &param)
Converts from ll::PortType enum to Vulkan DescriptorType.
T portTypeToString(ll::PortType &&value) noexcept
Converts from ll::PortType enum value to string.
Definition: PortType.h:54
uint32_t enum_t
Definition: enums.h:23