1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 01:24:11 +01:00

[d3d11] Filter redundant OMSetRenderTargets calls

Since rebinding render targets is a rather expensive
operation, we should avoid doing so whenever possible.

Affects Resident Evil 2 and Devil May Cry 5.
This commit is contained in:
Philip Rebohle 2019-08-26 23:59:08 +02:00
parent 4789790087
commit afc8e4c29d
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -2596,7 +2596,10 @@ namespace dxvk {
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
const UINT* pUAVInitialCounts) {
D3D10DeviceLock lock = LockContext();
bool needsUpdate = false;
bool needsSpill = false;
if (likely(NumRTVs != D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL)) {
// Native D3D11 does not change the render targets if
// the parameters passed to this method are invalid.
@ -2610,6 +2613,7 @@ namespace dxvk {
if (m_state.om.renderTargetViews[i] != rtv) {
m_state.om.renderTargetViews[i] = rtv;
needsUpdate = true;
TestOmSrvHazards(rtv);
}
}
@ -2618,14 +2622,13 @@ namespace dxvk {
if (m_state.om.depthStencilView != dsv) {
m_state.om.depthStencilView = dsv;
needsUpdate = true;
TestOmSrvHazards(dsv);
}
m_state.om.maxRtv = NumRTVs;
}
bool spillRenderPass = false;
if (unlikely(NumUAVs || m_state.om.maxUav)) {
uint32_t uavSlotId = computeUavBinding (DxbcProgramType::PixelShader, 0);
uint32_t ctrSlotId = computeUavCounterBinding(DxbcProgramType::PixelShader, 0);
@ -2652,13 +2655,14 @@ namespace dxvk {
TestOmSrvHazards(uav);
spillRenderPass = true;
needsSpill = true;
}
}
}
}
BindFramebuffer(spillRenderPass);
if (needsUpdate || needsSpill)
BindFramebuffer(needsSpill);
}