From 7514aa1ec857ffdf8ea2c9e8cac1497c27aa4722 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 20 Sep 2019 16:59:31 +0200 Subject: [PATCH] [d3d11] Implement IDXGIDevice4 --- src/d3d11/d3d11_device.cpp | 50 +++++++++++++++++++++++++++++++++----- src/d3d11/d3d11_device.h | 13 +++++++++- 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index fec92ec5b..ec2ee7046 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -2509,7 +2509,8 @@ namespace dxvk { || riid == __uuidof(IDXGIDevice) || riid == __uuidof(IDXGIDevice1) || riid == __uuidof(IDXGIDevice2) - || riid == __uuidof(IDXGIDevice3)) { + || riid == __uuidof(IDXGIDevice3) + || riid == __uuidof(IDXGIDevice4)) { *ppvObject = ref(this); return S_OK; } @@ -2657,18 +2658,55 @@ namespace dxvk { UINT NumResources, IDXGIResource* const* ppResources, DXGI_OFFER_RESOURCE_PRIORITY Priority) { - - Logger::err("D3D11DXGIDevice::OfferResources: Not implemented"); - return DXGI_ERROR_UNSUPPORTED; + return OfferResources1(NumResources, ppResources, Priority, 0); } + HRESULT STDMETHODCALLTYPE D3D11DXGIDevice::OfferResources1( + UINT NumResources, + IDXGIResource* const* ppResources, + DXGI_OFFER_RESOURCE_PRIORITY Priority, + UINT Flags) { + static bool s_errorShown = false; + + if (!std::exchange(s_errorShown, true)) + Logger::warn("D3D11DXGIDevice::OfferResources1: Stub"); + + return S_OK; + } + + HRESULT STDMETHODCALLTYPE D3D11DXGIDevice::ReclaimResources( UINT NumResources, IDXGIResource* const* ppResources, BOOL* pDiscarded) { - Logger::err("D3D11DXGIDevice::ReclaimResources: Not implemented"); - return DXGI_ERROR_UNSUPPORTED; + static bool s_errorShown = false; + + if (!std::exchange(s_errorShown, true)) + Logger::warn("D3D11DXGIDevice::ReclaimResources: Stub"); + + if (pDiscarded) + *pDiscarded = false; + + return S_OK; + } + + + HRESULT STDMETHODCALLTYPE D3D11DXGIDevice::ReclaimResources1( + UINT NumResources, + IDXGIResource* const* ppResources, + DXGI_RECLAIM_RESOURCE_RESULTS* pResults) { + static bool s_errorShown = false; + + if (!std::exchange(s_errorShown, true)) + Logger::warn("D3D11DXGIDevice::ReclaimResources1: Stub"); + + if (pResults) { + for (uint32_t i = 0; i < NumResources; i++) + pResults[i] = DXGI_RECLAIM_RESOURCE_RESULT_OK; + } + + return S_OK; } diff --git a/src/d3d11/d3d11_device.h b/src/d3d11/d3d11_device.h index ebd83cac2..2f42760d1 100644 --- a/src/d3d11/d3d11_device.h +++ b/src/d3d11/d3d11_device.h @@ -575,7 +575,7 @@ namespace dxvk { * Stores all the objects that contribute to the D3D11 * device implementation, including the DXGI device. */ - class D3D11DXGIDevice : public DxgiObject { + class D3D11DXGIDevice : public DxgiObject { constexpr static uint32_t DefaultFrameLatency = 3; public: @@ -627,10 +627,21 @@ namespace dxvk { IDXGIResource* const* ppResources, DXGI_OFFER_RESOURCE_PRIORITY Priority) final; + HRESULT STDMETHODCALLTYPE OfferResources1( + UINT NumResources, + IDXGIResource* const* ppResources, + DXGI_OFFER_RESOURCE_PRIORITY Priority, + UINT Flags) final; + HRESULT STDMETHODCALLTYPE ReclaimResources( UINT NumResources, IDXGIResource* const* ppResources, BOOL* pDiscarded) final; + + HRESULT STDMETHODCALLTYPE ReclaimResources1( + UINT NumResources, + IDXGIResource* const* ppResources, + DXGI_RECLAIM_RESOURCE_RESULTS* pResults) final; HRESULT STDMETHODCALLTYPE EnqueueSetEvent( HANDLE hEvent) final;