aboutsummaryrefslogtreecommitdiff
path: root/src/device_context.hh
blob: 975d67c689f72cd27040d5bb946dc3ab5271c3c7 (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
#ifndef DEVICE_CONTEXT_HH_
#define DEVICE_CONTEXT_HH_

#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 "strategies/device_strategy.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::unique_ptr<DeviceStrategy> strategy;

  public:
    DeviceContext(InstanceContext& parent_instance,
                  PhysicalDeviceContext& parent_physical,
                  const VkDevice& device, const bool was_capability_requested,
                  VkuDeviceDispatchTable&& vtable);
    virtual ~DeviceContext();
};

}; // namespace low_latency

#endif