Skip to content

Commit

Permalink
nvapi-vulkan: Log unsupported latency marker types only once (per thr…
Browse files Browse the repository at this point in the history
…ead)
  • Loading branch information
Saancreed committed Dec 30, 2024
1 parent 3ebd07d commit 5687a8b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/nvapi_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <string_view>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

Expand Down
15 changes: 9 additions & 6 deletions src/nvapi_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,17 @@ 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"));
return Ok(n);
}
if (marker != VK_LATENCY_MARKER_MAX_ENUM_NV) {
lowLatencyDevice->SetLatencyMarker(pSetLatencyMarkerParams->frameID, marker);
} else {
thread_local std::unordered_set<NV_VULKAN_LATENCY_MARKER_TYPE> unsupportedMarkerTypes{};

lowLatencyDevice->SetLatencyMarker(pSetLatencyMarkerParams->frameID, marker);
if (auto [it, inserted] = unsupportedMarkerTypes.insert(markerType); inserted)
log::info(str::format("unsupported NV_VULKAN_LATENCY_MARKER_TYPE (", markerType, "), ignoring"));
}

return Ok(n, alreadyLoggedOk);
}
Expand Down

0 comments on commit 5687a8b

Please sign in to comment.