summaryrefslogtreecommitdiff
path: root/src/vulkan_helper.h
blob: 089a09f6a97445960ab8f07c380fe7c0001c923a (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
25
26
27
28
29
30
#include <cstdint>
#include <vulkan/vulkan_core.h>
#include <vector>
#include <string>

#define CHECK_VULKAN(result)                                   \
    do {                                                       \
        VkResult res = result;                                 \
        if (res != VK_SUCCESS) {                               \
            /* TODO: throw error instead of returning */       \
            std::cerr << "Vulkan error: " << res << std::endl; \
            abort();                                           \
        }                                                      \
    } while (0)                                                

namespace iris {

struct Device {
    VkInstance instance;
    VkPhysicalDevice physical_device;
    VkDevice device;
    uint32_t main_queue_family_index;
    VkQueue graphics_queue;

    Device(
        std::vector<std::string> layers,
        std::vector<std::string> instance_extensions);
};

} // namespace iris