synchronisation.hpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once


#include <planet/vk/helpers.hpp>


namespace planet::vk {


    class device;


    class fence final {
        using handle_type = device_handle<VkFence, vkDestroyFence>;
        handle_type handle;

      public:
        fence(vk::device &);

        device_view device;
        VkFence get() const noexcept { return handle.get(); }

Returns true if the fence is ready

24
        bool is_ready() const;

Resets the fence

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
        void reset();
    };


    class semaphore final {
        using handle_type = device_handle<VkSemaphore, vkDestroySemaphore>;
        handle_type handle;

      public:
        semaphore(vk::device &);

        device_view device;
        VkSemaphore get() const noexcept { return handle.get(); }
    };


}