From 1af52abb6722c7f714c849996d4f8783b10b7fca Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 17 Mar 2018 14:09:16 +0100 Subject: [PATCH] [d3d11] Move OMSetRenderTargets optimization to D3D11ImmediateContext We cannot call Flush() on deferred contexts anyway, so the command submission optimization should only be applied to immediate contexts. --- src/d3d11/d3d11_context.cpp | 7 ------- src/d3d11/d3d11_context.h | 2 +- src/d3d11/d3d11_context_imm.cpp | 16 ++++++++++++++++ src/d3d11/d3d11_context_imm.h | 5 +++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 6be608af9..85297697e 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -1689,13 +1689,6 @@ namespace dxvk { UINT NumViews, ID3D11RenderTargetView* const* ppRenderTargetViews, ID3D11DepthStencilView* pDepthStencilView) { - // Optimization: If the number of draw and dispatch calls issued - // prior to the previous context flush is above a certain threshold, - // submit the current command buffer in order to keep the GPU busy. - // This also helps keep the command buffers at a reasonable size. - if (m_drawCount >= 500) - Flush(); - for (UINT i = 0; i < m_state.om.renderTargetViews.size(); i++) { D3D11RenderTargetView* view = nullptr; diff --git a/src/d3d11/d3d11_context.h b/src/d3d11/d3d11_context.h index 538816f82..80edababd 100644 --- a/src/d3d11/d3d11_context.h +++ b/src/d3d11/d3d11_context.h @@ -439,7 +439,7 @@ namespace dxvk { void STDMETHODCALLTYPE OMSetRenderTargets( UINT NumViews, ID3D11RenderTargetView* const* ppRenderTargetViews, - ID3D11DepthStencilView* pDepthStencilView) final; + ID3D11DepthStencilView* pDepthStencilView); void STDMETHODCALLTYPE OMSetRenderTargetsAndUnorderedAccessViews( UINT NumRTVs, diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index 6d5fe7d90..19e09c1a0 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -172,6 +172,22 @@ namespace dxvk { } + void STDMETHODCALLTYPE D3D11ImmediateContext::OMSetRenderTargets( + UINT NumViews, + ID3D11RenderTargetView* const* ppRenderTargetViews, + ID3D11DepthStencilView* pDepthStencilView) { + // Optimization: If the number of draw and dispatch calls issued + // prior to the previous context flush is above a certain threshold, + // submit the current command buffer in order to keep the GPU busy. + // This also helps keep the command buffers at a reasonable size. + if (m_drawCount >= 500) + Flush(); + + D3D11DeviceContext::OMSetRenderTargets( + NumViews, ppRenderTargetViews, pDepthStencilView); + } + + HRESULT D3D11ImmediateContext::MapImage( D3D11CommonTexture* pResource, UINT Subresource, diff --git a/src/d3d11/d3d11_context_imm.h b/src/d3d11/d3d11_context_imm.h index d2f192f47..84dc2c587 100644 --- a/src/d3d11/d3d11_context_imm.h +++ b/src/d3d11/d3d11_context_imm.h @@ -45,6 +45,11 @@ namespace dxvk { ID3D11Resource* pResource, UINT Subresource) final; + void STDMETHODCALLTYPE OMSetRenderTargets( + UINT NumViews, + ID3D11RenderTargetView* const* ppRenderTargetViews, + ID3D11DepthStencilView* pDepthStencilView) final; + void SynchronizeCsThread(); private: