From bc9ac845da5e1d412874ba15d44077035a7ddcbf Mon Sep 17 00:00:00 2001 From: Krzysztof Bogacki Date: Wed, 25 Dec 2024 17:16:47 +0100 Subject: [PATCH] nvapi-vulkan: Log unsupported latency marker types only once (per thread) --- src/nvapi_private.h | 1 + src/nvapi_vulkan.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/nvapi_private.h b/src/nvapi_private.h index 796341dc..66d8bd7f 100644 --- a/src/nvapi_private.h +++ b/src/nvapi_private.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include diff --git a/src/nvapi_vulkan.cpp b/src/nvapi_vulkan.cpp index b30f6313..892d3b17 100644 --- a/src/nvapi_vulkan.cpp +++ b/src/nvapi_vulkan.cpp @@ -213,10 +213,15 @@ extern "C" { if (!lowLatencyDevice) return HandleInvalidated(n); - auto marker = NvapiVulkanLowLatencyDevice::ToVkLatencyMarkerNV(pSetLatencyMarkerParams->markerType); + auto markerType = pSetLatencyMarkerParams->markerType; + auto marker = NvapiVulkanLowLatencyDevice::ToVkLatencyMarkerNV(markerType); if (marker == VK_LATENCY_MARKER_MAX_ENUM_NV) { - log::info(str::format("unsupported NV_VULKAN_LATENCY_MARKER_TYPE (", pSetLatencyMarkerParams->markerType, "), frameID = ", pSetLatencyMarkerParams->frameID, ", ignoring")); + thread_local std::unordered_set unsupportedMarkerTypes{}; + + if (auto [it, inserted] = unsupportedMarkerTypes.insert(markerType); inserted) + log::info(str::format("unsupported NV_VULKAN_LATENCY_MARKER_TYPE (", markerType, "), ignoring")); + return Ok(n); }