blob: df1b58d7e142fe1b67a6fb4ca12f0e1cf7578974 (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#ifndef DEVICE_CONTEXT_HH_
#define DEVICE_CONTEXT_HH_
#include <chrono>
#include <memory>
#include <unordered_map>
#include <vulkan/utility/vk_dispatch_table.h>
#include <vulkan/vk_layer.h>
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_core.h>
#include "context.hh"
#include "device_clock.hh"
#include "instance_context.hh"
#include "physical_device_context.hh"
#include "queue_context.hh"
#include "swapchain_monitor.hh"
namespace low_latency {
class DeviceContext final : public Context {
public:
InstanceContext& instance;
PhysicalDeviceContext& physical_device;
// Whether or not we were asked to do NV_VK_LowLatency2 or VK_AMD_anti_lag
// at the device level.
const bool was_capability_requested;
const VkDevice device;
const VkuDeviceDispatchTable vtable;
std::unique_ptr<DeviceClock> clock;
std::unordered_map<VkQueue, std::shared_ptr<QueueContext>> queues;
std::unordered_map<VkSwapchainKHR, std::unique_ptr<SwapchainMonitor>>
swapchain_monitors;
public:
DeviceContext(InstanceContext& parent_instance,
PhysicalDeviceContext& parent_physical,
const VkDevice& device, const bool was_capability_requested,
VkuDeviceDispatchTable&& vtable);
virtual ~DeviceContext();
public:
// Updates the settings associated with that swapchain. If no swapchain
// target is provided all swapchains are set to this value.
void update_params(const std::optional<VkSwapchainKHR> target,
const std::chrono::milliseconds& present_delay,
const bool was_low_latency_requested);
void notify_present(const VkSwapchainKHR& swapchain,
std::unique_ptr<QueueContext::Submissions> submissions);
};
}; // namespace low_latency
#endif
|