From 3eb96fb9e576e0ad425efe1d42cdf798f72c3ca9 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 16 Jan 2025 16:29:19 +0100 Subject: [PATCH] [d3d11] Stub out ID3DLowLatencyDevice for D3D11 --- src/d3d11/d3d11_device.cpp | 70 ++++++++++++++++++++++++++++++++++++++ src/d3d11/d3d11_device.h | 46 +++++++++++++++++++++++++ 2 files changed, 116 insertions(+) diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index 308c4674b..a33379f96 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -3058,6 +3058,70 @@ namespace dxvk { + D3D11ReflexDevice::D3D11ReflexDevice( + D3D11DXGIDevice* pContainer, + D3D11Device* pDevice) + : m_container(pContainer), m_device(pDevice) { + + } + + + D3D11ReflexDevice::~D3D11ReflexDevice() { + + } + + + ULONG STDMETHODCALLTYPE D3D11ReflexDevice::AddRef() { + return m_container->AddRef(); + } + + + ULONG STDMETHODCALLTYPE D3D11ReflexDevice::Release() { + return m_container->Release(); + } + + + HRESULT STDMETHODCALLTYPE D3D11ReflexDevice::QueryInterface( + REFIID riid, + void** ppvObject) { + return m_container->QueryInterface(riid, ppvObject); + } + + + BOOL STDMETHODCALLTYPE D3D11ReflexDevice::SupportsLowLatency() { + return FALSE; + } + + + HRESULT STDMETHODCALLTYPE D3D11ReflexDevice::LatencySleep() { + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D11ReflexDevice::SetLatencySleepMode( + BOOL LowLatencyEnable, + BOOL LowLatencyBoost, + UINT32 MinIntervalUs) { + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D11ReflexDevice::SetLatencyMarker( + UINT64 FrameId, + UINT32 MarkerType) { + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D11ReflexDevice::GetLatencyInfo( + D3D_LOW_LATENCY_RESULTS* pLowLatencyResults) { + *pLowLatencyResults = D3D_LOW_LATENCY_RESULTS(); + return E_NOTIMPL; + } + + + + DXGIVkSwapChainFactory::DXGIVkSwapChainFactory( D3D11DXGIDevice* pContainer, D3D11Device* pDevice) @@ -3159,6 +3223,7 @@ namespace dxvk { m_d3d11DeviceExt(this, &m_d3d11Device), m_d3d11Interop (this, &m_d3d11Device), m_d3d11Video (this, &m_d3d11Device), + m_d3d11Reflex (this, &m_d3d11Device), m_d3d11on12 (this, &m_d3d11Device, pD3D12Device, pD3D12Queue), m_metaDevice (this), m_dxvkFactory (this, &m_d3d11Device) { @@ -3231,6 +3296,11 @@ namespace dxvk { return S_OK; } + if (riid == __uuidof(ID3DLowLatencyDevice)) { + *ppvObject = ref(&m_d3d11Reflex); + return S_OK; + } + if (m_d3d11on12.Is11on12Device()) { if (riid == __uuidof(ID3D11On12Device)) { *ppvObject = ref(&m_d3d11on12); diff --git a/src/d3d11/d3d11_device.h b/src/d3d11/d3d11_device.h index f07cf7489..7adcf0db6 100644 --- a/src/d3d11/d3d11_device.h +++ b/src/d3d11/d3d11_device.h @@ -751,6 +751,51 @@ namespace dxvk { }; + /** + * \brief Nvidia Reflex interop + */ + class D3D11ReflexDevice : public ID3DLowLatencyDevice { + + public: + + D3D11ReflexDevice( + D3D11DXGIDevice* pContainer, + D3D11Device* pDevice); + + ~D3D11ReflexDevice(); + + ULONG STDMETHODCALLTYPE AddRef(); + + ULONG STDMETHODCALLTYPE Release(); + + HRESULT STDMETHODCALLTYPE QueryInterface( + REFIID riid, + void** ppvObject); + + BOOL STDMETHODCALLTYPE SupportsLowLatency(); + + HRESULT STDMETHODCALLTYPE LatencySleep(); + + HRESULT STDMETHODCALLTYPE SetLatencySleepMode( + BOOL LowLatencyEnable, + BOOL LowLatencyBoost, + UINT32 MinIntervalUs); + + HRESULT STDMETHODCALLTYPE SetLatencyMarker( + UINT64 FrameId, + UINT32 MarkerType); + + HRESULT STDMETHODCALLTYPE GetLatencyInfo( + D3D_LOW_LATENCY_RESULTS* pLowLatencyResults); + + private: + + D3D11DXGIDevice* m_container; + D3D11Device* m_device; + + }; + + /** * \brief DXVK swap chain factory */ @@ -914,6 +959,7 @@ namespace dxvk { D3D11DeviceExt m_d3d11DeviceExt; D3D11VkInterop m_d3d11Interop; D3D11VideoDevice m_d3d11Video; + D3D11ReflexDevice m_d3d11Reflex; D3D11on12Device m_d3d11on12; DXGIDXVKDevice m_metaDevice;