[d3d11] Add more implicit flush points

All these methods will implicitly spill the active render pass and
are typically not called very often, so we can try to keep the GPU
busy.
This commit is contained in:
Philip Rebohle 2018-06-27 18:34:17 +02:00
parent 6cc303c5ef
commit 9fee253d09
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 198 additions and 23 deletions

View File

@ -62,7 +62,7 @@ namespace dxvk {
UINT DstZ,
ID3D11Resource* pSrcResource,
UINT SrcSubresource,
const D3D11_BOX* pSrcBox) final;
const D3D11_BOX* pSrcBox);
void STDMETHODCALLTYPE CopySubresourceRegion1(
ID3D11Resource* pDstResource,
@ -73,11 +73,11 @@ namespace dxvk {
ID3D11Resource* pSrcResource,
UINT SrcSubresource,
const D3D11_BOX* pSrcBox,
UINT CopyFlags) final;
UINT CopyFlags);
void STDMETHODCALLTYPE CopyResource(
ID3D11Resource* pDstResource,
ID3D11Resource* pSrcResource) final;
ID3D11Resource* pSrcResource);
void STDMETHODCALLTYPE CopyStructureCount(
ID3D11Buffer* pDstBuffer,
@ -109,7 +109,7 @@ namespace dxvk {
UINT NumRects) final;
void STDMETHODCALLTYPE GenerateMips(
ID3D11ShaderResourceView* pShaderResourceView) final;
ID3D11ShaderResourceView* pShaderResourceView);
void STDMETHODCALLTYPE UpdateSubresource(
ID3D11Resource* pDstResource,
@ -117,7 +117,7 @@ namespace dxvk {
const D3D11_BOX* pDstBox,
const void* pSrcData,
UINT SrcRowPitch,
UINT SrcDepthPitch) final;
UINT SrcDepthPitch);
void STDMETHODCALLTYPE UpdateSubresource1(
ID3D11Resource* pDstResource,
@ -126,7 +126,7 @@ namespace dxvk {
const void* pSrcData,
UINT SrcRowPitch,
UINT SrcDepthPitch,
UINT CopyFlags) final;
UINT CopyFlags);
void STDMETHODCALLTYPE SetResourceMinLOD(
ID3D11Resource* pResource,
@ -140,7 +140,7 @@ namespace dxvk {
UINT DstSubresource,
ID3D11Resource* pSrcResource,
UINT SrcSubresource,
DXGI_FORMAT Format) final;
DXGI_FORMAT Format);
void STDMETHODCALLTYPE DrawAuto() final;
@ -566,7 +566,7 @@ namespace dxvk {
UINT UAVStartSlot,
UINT NumUAVs,
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
const UINT* pUAVInitialCounts) final;
const UINT* pUAVInitialCounts);
void STDMETHODCALLTYPE OMSetBlendState(
ID3D11BlendState* pBlendState,

View File

@ -191,6 +191,135 @@ namespace dxvk {
}
void STDMETHODCALLTYPE D3D11ImmediateContext::CopySubresourceRegion(
ID3D11Resource* pDstResource,
UINT DstSubresource,
UINT DstX,
UINT DstY,
UINT DstZ,
ID3D11Resource* pSrcResource,
UINT SrcSubresource,
const D3D11_BOX* pSrcBox) {
FlushImplicit();
D3D11DeviceContext::CopySubresourceRegion(
pDstResource, DstSubresource, DstX, DstY, DstZ,
pSrcResource, SrcSubresource, pSrcBox);
}
void STDMETHODCALLTYPE D3D11ImmediateContext::CopySubresourceRegion1(
ID3D11Resource* pDstResource,
UINT DstSubresource,
UINT DstX,
UINT DstY,
UINT DstZ,
ID3D11Resource* pSrcResource,
UINT SrcSubresource,
const D3D11_BOX* pSrcBox,
UINT CopyFlags) {
FlushImplicit();
D3D11DeviceContext::CopySubresourceRegion1(
pDstResource, DstSubresource, DstX, DstY, DstZ,
pSrcResource, SrcSubresource, pSrcBox, CopyFlags);
}
void STDMETHODCALLTYPE D3D11ImmediateContext::CopyResource(
ID3D11Resource* pDstResource,
ID3D11Resource* pSrcResource) {
FlushImplicit();
D3D11DeviceContext::CopyResource(
pDstResource, pSrcResource);
}
void STDMETHODCALLTYPE D3D11ImmediateContext::GenerateMips(
ID3D11ShaderResourceView* pShaderResourceView) {
FlushImplicit();
D3D11DeviceContext::GenerateMips(
pShaderResourceView);
}
void STDMETHODCALLTYPE D3D11ImmediateContext::UpdateSubresource(
ID3D11Resource* pDstResource,
UINT DstSubresource,
const D3D11_BOX* pDstBox,
const void* pSrcData,
UINT SrcRowPitch,
UINT SrcDepthPitch) {
FlushImplicit();
D3D11DeviceContext::UpdateSubresource(
pDstResource, DstSubresource, pDstBox,
pSrcData, SrcRowPitch, SrcDepthPitch);
}
void STDMETHODCALLTYPE D3D11ImmediateContext::UpdateSubresource1(
ID3D11Resource* pDstResource,
UINT DstSubresource,
const D3D11_BOX* pDstBox,
const void* pSrcData,
UINT SrcRowPitch,
UINT SrcDepthPitch,
UINT CopyFlags) {
FlushImplicit();
D3D11DeviceContext::UpdateSubresource1(
pDstResource, DstSubresource, pDstBox,
pSrcData, SrcRowPitch, SrcDepthPitch,
CopyFlags);
}
void STDMETHODCALLTYPE D3D11ImmediateContext::ResolveSubresource(
ID3D11Resource* pDstResource,
UINT DstSubresource,
ID3D11Resource* pSrcResource,
UINT SrcSubresource,
DXGI_FORMAT Format) {
FlushImplicit();
D3D11DeviceContext::ResolveSubresource(
pDstResource, DstSubresource,
pSrcResource, SrcSubresource,
Format);
}
void STDMETHODCALLTYPE D3D11ImmediateContext::OMSetRenderTargets(
UINT NumViews,
ID3D11RenderTargetView* const* ppRenderTargetViews,
ID3D11DepthStencilView* pDepthStencilView) {
FlushImplicit();
D3D11DeviceContext::OMSetRenderTargets(
NumViews, ppRenderTargetViews, pDepthStencilView);
}
void STDMETHODCALLTYPE D3D11ImmediateContext::OMSetRenderTargetsAndUnorderedAccessViews(
UINT NumRTVs,
ID3D11RenderTargetView* const* ppRenderTargetViews,
ID3D11DepthStencilView* pDepthStencilView,
UINT UAVStartSlot,
UINT NumUAVs,
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
const UINT* pUAVInitialCounts) {
FlushImplicit();
D3D11DeviceContext::OMSetRenderTargetsAndUnorderedAccessViews(
NumRTVs, ppRenderTargetViews, pDepthStencilView,
UAVStartSlot, NumUAVs, ppUnorderedAccessViews,
pUAVInitialCounts);
}
HRESULT D3D11ImmediateContext::MapBuffer(
D3D11Buffer* pResource,
D3D11_MAP MapType,
@ -234,21 +363,6 @@ 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.
FlushImplicit();
D3D11DeviceContext::OMSetRenderTargets(
NumViews, ppRenderTargetViews, pDepthStencilView);
}
HRESULT D3D11ImmediateContext::MapImage(
D3D11CommonTexture* pResource,
UINT Subresource,

View File

@ -54,11 +54,72 @@ namespace dxvk {
ID3D11Resource* pResource,
UINT Subresource) final;
void STDMETHODCALLTYPE CopySubresourceRegion(
ID3D11Resource* pDstResource,
UINT DstSubresource,
UINT DstX,
UINT DstY,
UINT DstZ,
ID3D11Resource* pSrcResource,
UINT SrcSubresource,
const D3D11_BOX* pSrcBox) final;
void STDMETHODCALLTYPE CopySubresourceRegion1(
ID3D11Resource* pDstResource,
UINT DstSubresource,
UINT DstX,
UINT DstY,
UINT DstZ,
ID3D11Resource* pSrcResource,
UINT SrcSubresource,
const D3D11_BOX* pSrcBox,
UINT CopyFlags) final;
void STDMETHODCALLTYPE CopyResource(
ID3D11Resource* pDstResource,
ID3D11Resource* pSrcResource) final;
void STDMETHODCALLTYPE GenerateMips(
ID3D11ShaderResourceView* pShaderResourceView) final;
void STDMETHODCALLTYPE UpdateSubresource(
ID3D11Resource* pDstResource,
UINT DstSubresource,
const D3D11_BOX* pDstBox,
const void* pSrcData,
UINT SrcRowPitch,
UINT SrcDepthPitch) final;
void STDMETHODCALLTYPE UpdateSubresource1(
ID3D11Resource* pDstResource,
UINT DstSubresource,
const D3D11_BOX* pDstBox,
const void* pSrcData,
UINT SrcRowPitch,
UINT SrcDepthPitch,
UINT CopyFlags) final;
void STDMETHODCALLTYPE ResolveSubresource(
ID3D11Resource* pDstResource,
UINT DstSubresource,
ID3D11Resource* pSrcResource,
UINT SrcSubresource,
DXGI_FORMAT Format) final;
void STDMETHODCALLTYPE OMSetRenderTargets(
UINT NumViews,
ID3D11RenderTargetView* const* ppRenderTargetViews,
ID3D11DepthStencilView* pDepthStencilView) final;
void STDMETHODCALLTYPE OMSetRenderTargetsAndUnorderedAccessViews(
UINT NumRTVs,
ID3D11RenderTargetView* const* ppRenderTargetViews,
ID3D11DepthStencilView* pDepthStencilView,
UINT UAVStartSlot,
UINT NumUAVs,
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
const UINT* pUAVInitialCounts) final;
void SynchronizeCsThread();
private: