aboutsummaryrefslogtreecommitdiff
path: root/src/strategies/low_latency2/device_strategy.hh
blob: 499b2aab78cb48d5a9f53a09264a1c6d48b4a667 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef STRATEGIES_LOW_LATENCY2_DEVICE_STRATEGY_HH_
#define STRATEGIES_LOW_LATENCY2_DEVICE_STRATEGY_HH_

#include "strategies/device_strategy.hh"
#include "swapchain_monitor.hh"

#include <shared_mutex>
#include <unordered_map>
#include <vulkan/vulkan_core.h>

namespace low_latency {

class DeviceContext;

class LowLatency2DeviceStrategy final : public DeviceStrategy {
  private:
    std::shared_mutex mutex;
    // swapchain -> swapchain monitor
    std::unordered_map<VkSwapchainKHR, SwapchainMonitor> swapchain_monitors;

  public:
    LowLatency2DeviceStrategy(DeviceContext& device);
    virtual ~LowLatency2DeviceStrategy();

  public:
    virtual void
    notify_create_swapchain(const VkSwapchainKHR& swapchain,
                            const VkSwapchainCreateInfoKHR& info) override;
    virtual void
    notify_destroy_swapchain(const VkSwapchainKHR& swapchain) override;

  public:
    void submit_swapchain_present_id(const VkSwapchainKHR& swapchain,
                                     const std::uint64_t& present_id);

    void notify_latency_sleep_mode(const VkSwapchainKHR& swapchain,
                                   const VkLatencySleepModeInfoNV* const info);

    void notify_latency_sleep_nv(const VkSwapchainKHR& swapchain,
                                 const VkLatencySleepInfoNV& info);
};

} // namespace low_latency

#endif