1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-22 16:54:27 +01:00

[d3d11] Flush more around non-multisampled render passes

This commit is contained in:
Philip Rebohle 2025-02-10 22:02:05 +01:00
parent e820c23216
commit e31c84640d
3 changed files with 22 additions and 2 deletions

View File

@ -929,6 +929,9 @@ namespace dxvk {
ctx->resolveImage(cDstImage, cSrcImage, region, cFormat); ctx->resolveImage(cDstImage, cSrcImage, region, cFormat);
}); });
if constexpr (!IsDeferred)
GetTypedContext()->m_hasPendingMsaaResolve = false;
} }
if (dstTextureInfo->HasSequenceNumber()) if (dstTextureInfo->HasSequenceNumber())
@ -4901,6 +4904,7 @@ namespace dxvk {
return; return;
bool needsUpdate = false; bool needsUpdate = false;
bool isMultisampled = false;
if (likely(NumRTVs != D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL)) { if (likely(NumRTVs != D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL)) {
// Native D3D11 does not change the render targets if // Native D3D11 does not change the render targets if
@ -4920,6 +4924,9 @@ namespace dxvk {
if (NumUAVs == D3D11_KEEP_UNORDERED_ACCESS_VIEWS) if (NumUAVs == D3D11_KEEP_UNORDERED_ACCESS_VIEWS)
ResolveOmUavHazards(rtv); ResolveOmUavHazards(rtv);
if (rtv && rtv->GetSampleCount() > 1u)
isMultisampled = true;
} }
} }
@ -4929,6 +4936,9 @@ namespace dxvk {
m_state.om.dsv = dsv; m_state.om.dsv = dsv;
needsUpdate = true; needsUpdate = true;
ResolveOmSrvHazards(dsv); ResolveOmSrvHazards(dsv);
if (dsv && dsv->GetSampleCount() > 1u)
isMultisampled = true;
} }
m_state.om.maxRtv = NumRTVs; m_state.om.maxRtv = NumRTVs;
@ -4972,7 +4982,12 @@ namespace dxvk {
if constexpr (!IsDeferred) { if constexpr (!IsDeferred) {
// Doing this makes it less likely to flush during render passes // Doing this makes it less likely to flush during render passes
GetTypedContext()->ConsiderFlush(GpuFlushType::ImplicitWeakHint); auto imm = GetTypedContext();
if (!imm->m_hasPendingMsaaResolve || !m_device->perfHints().preferRenderPassOps)
imm->ConsiderFlush(GpuFlushType::ImplicitMediumHint);
imm->m_hasPendingMsaaResolve |= isMultisampled;
} }
} }
} }

View File

@ -1035,6 +1035,9 @@ namespace dxvk {
// Notify the device that the context has been flushed, // Notify the device that the context has been flushed,
// this resets some resource initialization heuristics. // this resets some resource initialization heuristics.
m_parent->NotifyContextFlush(); m_parent->NotifyContextFlush();
// No point in tracking this across submissions
m_hasPendingMsaaResolve = false;
} }
@ -1081,7 +1084,7 @@ namespace dxvk {
if (pParent->GetOptions()->reproducibleCommandStream) if (pParent->GetOptions()->reproducibleCommandStream)
return GpuFlushType::ExplicitFlush; return GpuFlushType::ExplicitFlush;
else if (Device->perfHints().preferRenderPassOps) else if (Device->perfHints().preferRenderPassOps)
return GpuFlushType::ImplicitStrongHint; return GpuFlushType::ImplicitMediumHint;
else else
return GpuFlushType::ImplicitWeakHint; return GpuFlushType::ImplicitWeakHint;
} }

View File

@ -131,6 +131,8 @@ namespace dxvk {
VkDeviceSize m_discardMemoryCounter = 0u; VkDeviceSize m_discardMemoryCounter = 0u;
VkDeviceSize m_discardMemoryOnFlush = 0u; VkDeviceSize m_discardMemoryOnFlush = 0u;
bool m_hasPendingMsaaResolve = false;
D3D10Multithread m_multithread; D3D10Multithread m_multithread;
D3D11VideoContext m_videoContext; D3D11VideoContext m_videoContext;