aboutsummaryrefslogtreecommitdiff
path: root/src/device_context.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/device_context.hh')
-rw-r--r--src/device_context.hh39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/device_context.hh b/src/device_context.hh
index 3406da1..b55b70c 100644
--- a/src/device_context.hh
+++ b/src/device_context.hh
@@ -1,36 +1,69 @@
#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 "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;
-
// Do we need to use this unless we wrap dispatchable objects?
const PFN_vkSetDeviceLoaderData sdld;
std::unordered_map<VkQueue, std::shared_ptr<QueueContext>> queues;
+ // We map swapchains to image indexes and their last signalled semaphore.
+ using index_semaphores_t = std::unordered_map<std::uint32_t, VkSemaphore>;
+ std::unordered_map<VkSwapchainKHR, index_semaphores_t> swapchain_signals;
+
+ struct Clock {
+ using time_point_t = std::chrono::steady_clock::time_point;
+
+ 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);
+
+ time_point_t ticks_to_time(const std::uint64_t& ticks) const;
+ };
+ Clock clock;
+
public:
- DeviceContext(InstanceContext& parent_instance, const VkDevice& device,
- const PFN_vkSetDeviceLoaderData& sdld,
+ DeviceContext(InstanceContext& parent_instance,
+ PhysicalDeviceContext& parent_physical,
+ const VkDevice& device, const PFN_vkSetDeviceLoaderData& sdld,
VkuDeviceDispatchTable&& vtable);
virtual ~DeviceContext();
+
+ public:
+ void notify_acquire(const VkSwapchainKHR& swapchain,
+ const std::uint32_t& image_index,
+ const VkSemaphore& signal_semaphore);
+
+ public:
+ void calibrate_timestamps();
};
}; // namespace low_latency