Loading...
Searching...
No Matches
GpuCapabilities.hpp File Reference

Runtime probe of which GPU interop mechanisms are available on this system. More...

Detailed Description

Runtime probe of which GPU interop mechanisms are available on this system.

Every vendor video strategy (AJA, DeckLink, Magewell, Rivermax, …) needs to decide at init time which GPU interop mechanism to use:

  • true GPU-direct (CUDA VMM + nvidia_peermem, or AMD bus-addressable). NIC/card writes straight into VRAM.
  • sysmem-mediated via NVIDIA DVP (GL/D3D11/CUDA backends).
  • sysmem-mediated via AMD GL pinned-memory extensions.
  • page-locked host memory + plain copy.

Strategies that re-probe per-instance duplicate work and tend to disagree on edge cases (one detects DVP, another doesn't). This struct centralises detection: probe once at plugin init, hand the populated struct to each strategy.

Two-stage probe:

  • probeContextFree() runs without any GL/D3D context. It populates DVP loader state, CUDA driver loader state, kernel module presence, OS info. Cheap; can run at plugin load.
  • probeFromQRhi(QRhi*) augments with renderer string + the QRhi backend identity. The AMD extension probe requires a live GL context; if QRhi is on Vulkan/D3D, AMD-pinned is N/A.
  • probeGlExtensions() is the GL-only deep probe used when score genuinely runs on the GL backend (AJA-AMD demo path style).

The struct is value-typed and trivially copyable; pass by value or by const ref to strategies. There's intentionally no singleton — each plugin/addon that needs capabilities should call probeContextFree() once and store the result.

Go to the source code of this file.

Classes

struct  score::gfx::interop::AmdGlExtensions
 
struct  score::gfx::interop::GpuCapabilities
 

Namespaces

namespace  score
 Base toolkit upon which the software is built.
 
namespace  score::gfx
 Graphics rendering pipeline for ossia score.
 

Enumerations

enum class  score::gfx::interop::GpuVendor : uint8_t {
  Unknown = 0 , NvidiaConsumer , NvidiaProQuadro , Amd ,
  Apple , Intel , Other
}
 
enum class  score::gfx::interop::HostOs : uint8_t { Linux = 0 , Windows , MacOS , Other }
 
enum class  score::gfx::interop::QRhiBackendKind : uint8_t {
  Unknown = 0 , OpenGL , Vulkan , D3D11 ,
  D3D12 , Metal , Null
}
 

Functions

GpuCapabilities score::gfx::interop::probeContextFree ()
 
void score::gfx::interop::probeFromQRhi (GpuCapabilities &caps, QRhi *rhi) noexcept
 
void score::gfx::interop::probeGlExtensions (GpuCapabilities &caps) noexcept
 
void score::gfx::interop::probeGlExtensions (GpuCapabilities &caps, QRhi *rhi) noexcept
 
const char * score::gfx::interop::gpuVendorName (GpuVendor v) noexcept
 
const char * score::gfx::interop::qrhiBackendName (QRhiBackendKind b) noexcept
 

Enumeration Type Documentation

◆ GpuVendor

enum class score::gfx::interop::GpuVendor : uint8_t
strong

Coarse GPU vendor label derived from renderer string / driver fingerprint.

Enumerator
NvidiaConsumer 

GeForce. GPU-direct RDMA is unavailable (driver-gated).

NvidiaProQuadro 

Quadro / RTX A-series / Tesla. GPU-direct RDMA enabled by driver.

Amd 

Radeon, Radeon Pro, FirePro. AMD-pinned + DirectGMA candidates.

Apple 

Apple Silicon / AMD on macOS — Metal-native.

Intel 

Iris / Arc — no GPU-direct paths.

◆ HostOs

enum class score::gfx::interop::HostOs : uint8_t
strong

OS label. Matters because some paths (nvidia_peermem, AMD bus addressable, V4L2 MMAP) are Linux-only; D3D11/D3D12 are Windows-only; Metal is macOS-only.

◆ QRhiBackendKind

enum class score::gfx::interop::QRhiBackendKind : uint8_t
strong

Which QRhi backend the renderer is currently using. AMD GL extensions are visible only when the live backend is GL. DVP can target GL or D3D11; the active QRhi backend decides which DVP init path the strategy will pick.

Function Documentation

◆ gpuVendorName()

const char * score::gfx::interop::gpuVendorName ( GpuVendor  v)
noexcept

Human-readable names for the enums above, for init logs and the diagnostic UI.

◆ probeContextFree()

GpuCapabilities score::gfx::interop::probeContextFree ( )

Run the context-free probe: OS, vendor (best-effort without GL), DVP, CUDA, kernel modules.

Idempotent: safe to call from multiple threads; the underlying DVP and CUDA loaders are themselves idempotent.

◆ probeFromQRhi()

void score::gfx::interop::probeFromQRhi ( GpuCapabilities caps,
QRhi *  rhi 
)
noexcept

Augment an existing capability struct with QRhi-side info: the renderer name, backend kind, and Vulkan external-memory readiness. Calls back into QRhi's introspection (no extra context required).

◆ probeGlExtensions() [1/2]

void score::gfx::interop::probeGlExtensions ( GpuCapabilities caps)
noexcept

Probe AMD GL extension presence. Requires an OpenGL context to be current on the calling thread (the QRhi GL backend's context, or a sample-side context for tools).

Idempotent: re-probing on a different GL context updates the flags.

◆ probeGlExtensions() [2/2]

void score::gfx::interop::probeGlExtensions ( GpuCapabilities caps,
QRhi *  rhi 
)
noexcept

As above, but able to recover the GL context from rhi's native handles when none is current on the calling thread — which is the normal state at setup time, since QRhi only makes its context current inside a frame.