diff options
| author | Nicolas James <nj3ahxac@gmail.com> | 2026-03-10 22:41:39 +1100 |
|---|---|---|
| committer | Nicolas James <nj3ahxac@gmail.com> | 2026-03-10 22:41:39 +1100 |
| commit | f10074d9897850b9b746ff8d8e0b2dc4af24f3ff (patch) | |
| tree | 4609d86b8222115c3e3d19824748861cbec78e20 /src/physical_device_context.cc | |
| parent | 50f009b81218c5367031ce9c51089ecddc2e853a (diff) | |
Don't advertise anti lag if the PD doesn't support it
Diffstat (limited to 'src/physical_device_context.cc')
| -rw-r--r-- | src/physical_device_context.cc | 26 |
1 files changed, 26 insertions, 0 deletions
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 <vulkan/vulkan_core.h> +#include <ranges> +#include <string_view> +#include <unordered_set> +#include <vector> + namespace low_latency { PhysicalDeviceContext::PhysicalDeviceContext( @@ -29,6 +34,27 @@ PhysicalDeviceContext::PhysicalDeviceContext( return std::make_unique<qp_t>(std::move(result)); }(); + + this->supports_required_extensions = [&]() { + auto count = std::uint32_t{}; + vtable.EnumerateDeviceExtensionProperties(physical_device, nullptr, + &count, nullptr); + + auto supported_extensions = std::vector<VkExtensionProperties>(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<std::unordered_set<std::string_view>>(); + + return std::ranges::all_of( + this->required_extensions, [&](const auto& required_extension) { + return supported_extension_names.contains(required_extension); + }); + }(); } PhysicalDeviceContext::~PhysicalDeviceContext() {} |
