aboutsummaryrefslogtreecommitdiff
path: root/src/physical_device_context.cc
diff options
context:
space:
mode:
authorNicolas James <Eele1Ephe7uZahRie@tutanota.com>2026-02-20 20:57:37 +1100
committerNicolas James <Eele1Ephe7uZahRie@tutanota.com>2026-02-20 20:57:37 +1100
commit7f3439714858d4c70f60db71543df15db5708d92 (patch)
tree93ce5d3f5f9ec715b0c3627ae82362175678c9d7 /src/physical_device_context.cc
parent9954233c9a730acba0a433dabd158ee5e8f131a5 (diff)
Don't inject timestamps into unsupported queues
Diffstat (limited to 'src/physical_device_context.cc')
-rw-r--r--src/physical_device_context.cc41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/physical_device_context.cc b/src/physical_device_context.cc
index d265c9d..2d1afc3 100644
--- a/src/physical_device_context.cc
+++ b/src/physical_device_context.cc
@@ -1,17 +1,44 @@
#include "physical_device_context.hh"
+#include <vulkan/vulkan_core.h>
namespace low_latency {
-
-PhysicalDeviceContext::PhysicalDeviceContext(
- InstanceContext& instance_context, const VkPhysicalDevice& physical_device)
- : instance(instance_context), physical_device(physical_device) {
+
+static std::unique_ptr<VkPhysicalDeviceProperties>
+make_pd_props(const InstanceContext& instance_context,
+ const VkPhysicalDevice& physical_device) {
+ const auto& vtable = instance_context.vtable;
auto props = VkPhysicalDeviceProperties{};
- instance.vtable.GetPhysicalDeviceProperties(this->physical_device, &props);
- this->properties =
- std::make_unique<VkPhysicalDeviceProperties>(std::move(props));
+ vtable.GetPhysicalDeviceProperties(physical_device, &props);
+ return std::make_unique<VkPhysicalDeviceProperties>(std::move(props));
+}
+
+static std::unique_ptr<PhysicalDeviceContext::queue_properties_t>
+make_qf_props(const InstanceContext& instance_context,
+ const VkPhysicalDevice& physical_device) {
+
+ const auto& vtable = instance_context.vtable;
+
+ auto count = std::uint32_t{};
+ vtable.GetPhysicalDeviceQueueFamilyProperties2(physical_device, &count,
+ nullptr);
+
+ auto result = std::vector<VkQueueFamilyProperties2>(
+ count, VkQueueFamilyProperties2{
+ .sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2});
+ vtable.GetPhysicalDeviceQueueFamilyProperties2(physical_device, &count,
+ std::data(result));
+
+ using qp_t = PhysicalDeviceContext::queue_properties_t;
+ return std::make_unique<qp_t>(std::move(result));
}
+PhysicalDeviceContext::PhysicalDeviceContext(
+ InstanceContext& instance_context, const VkPhysicalDevice& physical_device)
+ : instance(instance_context), physical_device(physical_device),
+ properties(make_pd_props(instance, physical_device)),
+ queue_properties(make_qf_props(instance, physical_device)) {}
+
PhysicalDeviceContext::~PhysicalDeviceContext() {}
} // namespace low_latency \ No newline at end of file