#ifndef DEVICE_CONTEXT_HH_ #define DEVICE_CONTEXT_HH_ #include #include #include #include #include #include #include #include "context.hh" #include "instance_context.hh" #include "physical_device_context.hh" namespace low_latency { class QueueContext; struct DeviceContext final : public Context { public: InstanceContext& instance; PhysicalDeviceContext& physical_device; const VkDevice device; const VkuDeviceDispatchTable vtable; std::unordered_map> queues; // We map swapchains to image indexes and their last signalled semaphore. using index_semaphores_t = std::unordered_map; std::unordered_map swapchain_signals; struct Clock { public: using time_point_t = std::chrono::time_point; const DeviceContext& device; public: time_point_t cpu_time; std::uint64_t error_bound; std::uint64_t device_ticks; std::uint64_t host_ns; std::uint64_t ticks_per_ns; public: Clock(const DeviceContext& device); ~Clock(); public: void calibrate(); time_point_t ticks_to_time(const std::uint64_t& ticks) const; }; Clock clock; public: DeviceContext(InstanceContext& parent_instance, PhysicalDeviceContext& parent_physical, const VkDevice& device, VkuDeviceDispatchTable&& vtable); virtual ~DeviceContext(); public: void notify_acquire(const VkSwapchainKHR& swapchain, const std::uint32_t& image_index, const VkSemaphore& signal_semaphore); }; }; // namespace low_latency #endif