aboutsummaryrefslogtreecommitdiff
path: root/src/physical_device_context.hh
blob: f7ad2892d09275dbb75d2907a0f5469126e81fb6 (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
#ifndef PHYSICAL_DEVICE_CONTEXT_HH_
#define PHYSICAL_DEVICE_CONTEXT_HH_

#include "instance_context.hh"

#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan_core.h>

#include "context.hh"

namespace low_latency {

class PhysicalDeviceContext final : public Context {
  public:
    // The extensions we need for our layer to function.
    // If the PD doesn't support this then the layer shouldn't set the anti lag
    // flag in VkGetPhysicalDevices2 (check this->supports_required_extensions).
    static constexpr auto required_extensions = {
        VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME,
        VK_KHR_CALIBRATED_TIMESTAMPS_EXTENSION_NAME,
        VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME,
        VK_KHR_PRESENT_ID_EXTENSION_NAME};

  public:
    InstanceContext& instance;

    const VkPhysicalDevice physical_device;

    std::unique_ptr<const VkPhysicalDeviceProperties> properties;

    using queue_properties_t = std::vector<VkQueueFamilyProperties2>;
    std::unique_ptr<const queue_properties_t> queue_properties;

    // Will be true if the physical device supports everything in
    // this->required_extensions.
    bool supports_required_extensions = false;

  public:
    PhysicalDeviceContext(InstanceContext& instance_context,
                          const VkPhysicalDevice& physical_device);
    virtual ~PhysicalDeviceContext();
};

} // namespace low_latency

#endif