aboutsummaryrefslogtreecommitdiff
path: root/src/physical_device_context.hh
blob: d2e094e40d692cf14011e9a7f89376032efd49fb (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
#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<VkPhysicalDeviceProperties> properties;
    std::unique_ptr<std::vector<VkQueueFamilyProperties2>> queue_properties;

    // Will be true if the physical device supports all of required_extensions.
    bool supports_required_extensions = false;

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

} // namespace low_latency

#endif