debug_messenger.hpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#pragma once


#include <planet/vk/helpers.hpp>


namespace planet::vk {


    class instance;

Debug messenger instance

14
15
16
17
18
19
20
21
22
23
24
25
26
    class debug_messenger final {
        VkInstance instance_handle = VK_NULL_HANDLE;
        VkDebugUtilsMessengerEXT handle = VK_NULL_HANDLE;

      public:
        debug_messenger() {}
        debug_messenger(debug_messenger const &) = delete;
        debug_messenger(debug_messenger &&) = delete;
        debug_messenger(
                vk::instance const &,
                PFN_vkDebugUtilsMessengerCallbackEXT,
                void * = nullptr);
        ~debug_messenger();

Fill in the create info structure

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
        static VkDebugUtilsMessengerCreateInfoEXT create_info(
                PFN_vkDebugUtilsMessengerCallbackEXT, void * = nullptr);

        debug_messenger &operator=(debug_messenger const &) = delete;
        debug_messenger &operator=(debug_messenger &&o) {
            std::swap(instance_handle, o.instance_handle);
            std::swap(handle, o.handle);
            return *this;
        }

        VkDebugUtilsMessengerEXT get() const noexcept { return handle; }
    };


}