aboutsummaryrefslogtreecommitdiff
path: root/src/vulkan_utils.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vulkan_utils.hpp')
-rw-r--r--src/vulkan_utils.hpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vulkan_utils.hpp b/src/vulkan_utils.hpp
new file mode 100644
index 0000000..8e6f617
--- /dev/null
+++ b/src/vulkan_utils.hpp
@@ -0,0 +1,24 @@
+#ifndef VULKAN_UTILS_HPP
+#define VULKAN_UTILS_HPP
+
+#include <ostream>
+// I don't know if we should directly include vulkan or not
+#define GLFW_INCLUDE_VULKAN
+#include <GLFW/glfw3.h>
+
+namespace engine::myvk {
+
+struct api { uint32_t raw; };
+
+constexpr std::ostream& operator<<(std::ostream& os, const api& api) {
+ // this code is unreadable but it amuses me
+ return (VK_API_VERSION_VARIANT(api.raw) == 0 ? os : os << "(variant "
+ << VK_API_VERSION_VARIANT(api.raw) << ") ")
+ << VK_API_VERSION_MAJOR (api.raw) << "."
+ << VK_API_VERSION_MINOR (api.raw) << "."
+ << VK_API_VERSION_PATCH (api.raw);
+}
+
+}
+
+#endif // VULKAN_UTILS_HPP