diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-08-05 05:56:59 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-08-05 05:56:59 +0000 |
| commit | ba38a3e2e68977d4a109fdf049b774b75146320a (patch) | |
| tree | 4192ff376be84887f1b528d592c8162bd9b6b29c /Graphics/GraphicsEngineD3DBase | |
| parent | Switched to using Volk on Windows (https://github.com/DiligentGraphics/Dilige... (diff) | |
| download | DiligentCore-ba38a3e2e68977d4a109fdf049b774b75146320a.tar.gz DiligentCore-ba38a3e2e68977d4a109fdf049b774b75146320a.zip | |
Fixed IDXGISwapChain2 issue on Windows 7 (closed https://github.com/DiligentGraphics/DiligentEngine/issues/95).
Diffstat (limited to 'Graphics/GraphicsEngineD3DBase')
| -rw-r--r-- | Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp b/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp index 0389f583..701361d1 100644 --- a/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp +++ b/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp @@ -205,7 +205,7 @@ protected: // false if an application is not manifested for Windows 8.1 or Windows 10, even if the current // operating system version is Windows 8.1 or Windows 10. CComPtr<IDXGIFactory3> pDXGIFactory3; - if (SUCCEEDED(pDXGIFactory->QueryInterface(__uuidof(pDXGIFactory3), reinterpret_cast<void**>(static_cast<IDXGIFactory3**>(&pDXGIFactory3))))) + if (SUCCEEDED(pDXGIFactory.QueryInterface(&pDXGIFactory3))) { swapChainDesc.Flags |= DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT; } @@ -254,16 +254,20 @@ protected: #endif - hr = pSwapChain1->QueryInterface(__uuidof(m_pSwapChain), reinterpret_cast<void**>(static_cast<DXGISwapChainType**>(&m_pSwapChain))); + hr = pSwapChain1.QueryInterface(&m_pSwapChain); CHECK_D3D_RESULT_THROW(hr, "Failed to query the required swap chain interface"); if ((swapChainDesc.Flags & DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT) != 0) { - // IMPORTANT: SetMaximumFrameLatency must be called BEFORE GetFrameLatencyWaitableObject! - m_pSwapChain->SetMaximumFrameLatency(m_MaxFrameLatency); + CComPtr<IDXGISwapChain2> pSwapChain2; + if (SUCCEEDED(pSwapChain1.QueryInterface(&pSwapChain2))) + { + // IMPORTANT: SetMaximumFrameLatency must be called BEFORE GetFrameLatencyWaitableObject! + pSwapChain2->SetMaximumFrameLatency(m_MaxFrameLatency); - m_FrameLatencyWaitableObject = m_pSwapChain->GetFrameLatencyWaitableObject(); - VERIFY(m_FrameLatencyWaitableObject != NULL, "Waitable object must not be null"); + m_FrameLatencyWaitableObject = pSwapChain2->GetFrameLatencyWaitableObject(); + VERIFY(m_FrameLatencyWaitableObject != NULL, "Waitable object must not be null"); + } } else { |
