Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
capability_fallback.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <atomic>
7#include <cstdint>
8
9namespace pulp::view {
10
26 const char* msg) {
27 // The bitmask has one bit per capability ordinal. Guard the ceiling at
28 // compile time so adding a 65th capability is a build error here rather
29 // than silent dedup corruption (a shift past the width aliases another
30 // cap's bit, or is UB). scene_cache..count are well within 64 today.
31 static_assert(
32 static_cast<std::uint32_t>(canvas::CanvasCapability::count) <= 64,
33 "warn-once dedup uses a 64-bit bitmask keyed by capability ordinal; "
34 "widen `warned` past uint64_t if CanvasCapability exceeds 64 members.");
35 static std::atomic<std::uint64_t> warned{0};
36 const std::uint64_t bit = std::uint64_t{1} << static_cast<std::uint32_t>(cap);
37 if ((warned.fetch_or(bit, std::memory_order_relaxed) & bit) != 0) return;
38 pulp::runtime::log_warn("{}", msg);
39}
40
41} // namespace pulp::view
CanvasCapability
Queryable backend capabilities.
Definition canvas_capability.hpp:19
@ count
sentinel: number of real capabilities (keep LAST)
Definition canvas_capability.hpp:38
void log_warn(std::format_string< Args... > fmt, Args &&... args)
Definition log.hpp:190
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
void warn_capability_fallback_once(canvas::CanvasCapability cap, const char *msg)
Warn at most once per process, per capability, when a paint path degrades because the active canvas b...
Definition capability_fallback.hpp:25