From f10074d9897850b9b746ff8d8e0b2dc4af24f3ff Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Tue, 10 Mar 2026 22:41:39 +1100 Subject: Don't advertise anti lag if the PD doesn't support it --- src/physical_device_context.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/physical_device_context.cc') diff --git a/src/physical_device_context.cc b/src/physical_device_context.cc index 45be10e..de63b3d 100644 --- a/src/physical_device_context.cc +++ b/src/physical_device_context.cc @@ -1,6 +1,11 @@ #include "physical_device_context.hh" #include +#include +#include +#include +#include + namespace low_latency { PhysicalDeviceContext::PhysicalDeviceContext( @@ -29,6 +34,27 @@ PhysicalDeviceContext::PhysicalDeviceContext( return std::make_unique(std::move(result)); }(); + + this->supports_required_extensions = [&]() { + auto count = std::uint32_t{}; + vtable.EnumerateDeviceExtensionProperties(physical_device, nullptr, + &count, nullptr); + + auto supported_extensions = std::vector(count); + vtable.EnumerateDeviceExtensionProperties( + physical_device, nullptr, &count, std::data(supported_extensions)); + + const auto supported_extension_names = + supported_extensions | + std::views::transform( + [](const auto& supported) { return supported.extensionName; }) | + std::ranges::to>(); + + return std::ranges::all_of( + this->required_extensions, [&](const auto& required_extension) { + return supported_extension_names.contains(required_extension); + }); + }(); } PhysicalDeviceContext::~PhysicalDeviceContext() {} -- cgit v1.2.3