aboutsummaryrefslogtreecommitdiff
path: root/src/vulkan_utils.hpp
blob: 8e6f61728e1ca48a114637fcff930be84f327644 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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