5#if defined(Q_OS_WIN) && defined(QGC_HAS_GST_D3D12_GPU_PATH)
7#include <gst/d3d12/gstd3d12.h>
15namespace GstD3D12ContextBridge {
18GstD3DContextBridgeCommon::BridgeState s_state;
20GstObject* createDevice(
const QLoggingCategory& cat)
26 GstD3D12Device* device = gst_d3d12_device_new_for_adapter_luid(luid);
28 qCWarning(cat) <<
"gst_d3d12_device_new_for_adapter_luid failed (luid=" << luid <<
")";
32 GstD3DContextBridgeCommon::logAdapterMatch(luid, device, cat,
"D3D12");
33 return GST_OBJECT(device);
36GstContext* makeContext(GstObject* device)
39 return gst_d3d12_context_new(GST_D3D12_DEVICE_CAST(device));
42const GstD3DContextBridgeCommon::BridgeOps s_ops = {
43 "D3D12", GST_D3D12_DEVICE_HANDLE_CONTEXT_TYPE, &GstD3D12BridgeLog, int(QRhi::D3D12), &createDevice, &makeContext,
46struct D3D12BridgeRegistrar
48 D3D12BridgeRegistrar() { GstD3DContextBridgeCommon::registerBridge(GstD3D12BridgeLog(), &handleSyncMessage, &reset); }
51static D3D12BridgeRegistrar s_d3d12BridgeRegistrar;
57 return GstD3DContextBridgeCommon::prime(s_state, s_ops);
60GstD3D12Device* currentDevice()
62 return GST_D3D12_DEVICE_CAST(GstD3DContextBridgeCommon::currentDevice(s_state));
65GstBusSyncReply handleSyncMessage(GstMessage* message)
67 return GstD3DContextBridgeCommon::handleSyncMessage(s_state, s_ops, message);
70bool answerContextQuery(GstQuery* query)
72 return GstD3DContextBridgeCommon::answerContextQuery(s_state, s_ops, query);
77 GstD3DContextBridgeCommon::reset(s_state, s_ops);
#define QGC_LOGGING_CATEGORY(name, categoryStr)
DeviceSnapshot & deviceSnapshot() noexcept
Returns the global snapshot. Atomic fields make individual reads thread-safe.
std::atomic< qint64 > adapterLuid
Composed (high<<32)|low LUID, 0 if unknown.