1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-24 13:54:17 +01:00

[d3d11] Ignore Flush calls if we are waiting for a resolve

This commit is contained in:
Philip Rebohle 2025-02-07 12:43:38 +01:00
parent cce3f375a8
commit a1b6de5cdc
5 changed files with 28 additions and 3 deletions

View File

@ -923,6 +923,9 @@ namespace dxvk {
ctx->resolveImage(cDstImage, cSrcImage, region, cFormat);
});
if constexpr (!IsDeferred)
GetTypedContext()->m_ignoreNextExplicitFlush = false;
}
if (dstTextureInfo->HasSequenceNumber())
@ -4895,6 +4898,7 @@ namespace dxvk {
return;
bool needsUpdate = false;
bool isMultisampled = false;
if (likely(NumRTVs != D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL)) {
// Native D3D11 does not change the render targets if
@ -4915,6 +4919,9 @@ namespace dxvk {
if (NumUAVs == D3D11_KEEP_UNORDERED_ACCESS_VIEWS)
ResolveOmUavHazards(rtv);
}
if (rtv && rtv->GetSampleCount() > 1u)
isMultisampled = true;
}
auto dsv = static_cast<D3D11DepthStencilView*>(pDepthStencilView);
@ -4966,6 +4973,7 @@ namespace dxvk {
if constexpr (!IsDeferred) {
// Doing this makes it less likely to flush during render passes
GetTypedContext()->m_ignoreNextExplicitFlush |= isMultisampled;
GetTypedContext()->ConsiderFlush(GpuFlushType::ImplicitWeakHint);
}
}

View File

@ -156,6 +156,12 @@ namespace dxvk {
void STDMETHODCALLTYPE D3D11ImmediateContext::Flush() {
D3D10DeviceLock lock = LockContext();
// Don't flush in tiler mode if we're waiting for a multisample resolve
bool needsFlush = !m_device->perfHints().preferRenderPassOps
|| m_parent->Is11on12Device()
|| m_parent->HasSharedResources();
if (needsFlush || !m_ignoreNextExplicitFlush)
ExecuteFlush(GpuFlushType::ExplicitFlush, nullptr, true);
}
@ -873,6 +879,8 @@ namespace dxvk {
if (cTracker && cTracker->needsAutoMarkers())
ctx->endLatencyTracking(cTracker);
});
m_ignoreNextExplicitFlush = false;
}

View File

@ -136,6 +136,8 @@ namespace dxvk {
Com<D3D11DeviceContextState, false> m_stateObject;
bool m_ignoreNextExplicitFlush = false;
HRESULT MapBuffer(
D3D11Buffer* pResource,
D3D11_MAP MapType,

View File

@ -2369,6 +2369,7 @@ namespace dxvk {
try {
const Com<D3D11Texture2D> texture = new D3D11Texture2D(this, &d3d11Desc, nullptr, hResource);
texture->QueryInterface(ReturnedInterface, ppResource);
m_hasSharedResources.store(true);
return S_OK;
}
catch (const DxvkError& e) {

View File

@ -464,6 +464,10 @@ namespace dxvk {
bool Is11on12Device() const;
bool HasSharedResources() const {
return m_hasSharedResources.load();
}
static D3D_FEATURE_LEVEL GetMaxFeatureLevel(
const Rc<DxvkInstance>& Instance,
const Rc<DxvkAdapter>& Adapter);
@ -512,6 +516,8 @@ namespace dxvk {
D3D_FEATURE_LEVEL m_maxFeatureLevel;
D3D11DeviceFeatures m_deviceFeatures;
std::atomic<bool> m_hasSharedResources = { false };
HRESULT CreateShaderModule(
D3D11CommonShader* pShaderModule,
DxvkShaderKey ShaderKey,