10constexpr const HwPathDescriptor* kCompiledPaths[] = {
11#if defined(QGC_HAS_GST_CUDA_GPU_PATH)
14#if defined(QGC_HAS_GST_DMABUF_GPU_PATH)
17#if defined(QGC_HAS_GST_GLMEMORY_GPU_PATH)
18 &GstHwPaths::kGlMemory,
20#if defined(QGC_HAS_GST_D3D11_GPU_PATH)
23#if defined(QGC_HAS_GST_D3D12_GPU_PATH)
26#if defined(QGC_HAS_GST_VULKAN_GPU_PATH)
29#if defined(QGC_HAS_GST_IOSURFACE_GPU_PATH)
30 &GstHwPaths::kIOSurface,
32#if defined(QGC_HAS_GST_AHARDWAREBUFFER_GPU_PATH)
33 &GstHwPaths::kAHardwareBuffer,
37#ifdef QGC_UNITTEST_BUILD
38constinit std::atomic<const std::vector<const HwPathDescriptor*>*> s_testPaths{
nullptr};
43std::span<const HwPathDescriptor* const>
paths() noexcept
45#ifdef QGC_UNITTEST_BUILD
46 if (
const auto* testPaths = s_testPaths.load(std::memory_order_acquire)) {
50 return kCompiledPaths;
55 const auto compiled =
paths();
56 return std::any_of(compiled.begin(), compiled.end(),
57 [path](
const HwPathDescriptor* descriptor) { return descriptor->path == path; });
60#ifdef QGC_UNITTEST_BUILD
61ScopedPathsForTest::ScopedPathsForTest(std::initializer_list<const HwPathDescriptor*>
paths)
63 , _previous(s_testPaths.exchange(&_paths, std::memory_order_acq_rel))
66ScopedPathsForTest::~ScopedPathsForTest()
68 s_testPaths.store(_previous, std::memory_order_release);