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:
parent
cce3f375a8
commit
a1b6de5cdc
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,13 @@ namespace dxvk {
|
||||
void STDMETHODCALLTYPE D3D11ImmediateContext::Flush() {
|
||||
D3D10DeviceLock lock = LockContext();
|
||||
|
||||
ExecuteFlush(GpuFlushType::ExplicitFlush, nullptr, true);
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,6 +136,8 @@ namespace dxvk {
|
||||
|
||||
Com<D3D11DeviceContextState, false> m_stateObject;
|
||||
|
||||
bool m_ignoreNextExplicitFlush = false;
|
||||
|
||||
HRESULT MapBuffer(
|
||||
D3D11Buffer* pResource,
|
||||
D3D11_MAP MapType,
|
||||
|
@ -1893,8 +1893,8 @@ namespace dxvk {
|
||||
bool D3D11Device::Is11on12Device() const {
|
||||
return m_container->Is11on12Device();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
D3D_FEATURE_LEVEL D3D11Device::GetMaxFeatureLevel(
|
||||
const Rc<DxvkInstance>& Instance,
|
||||
const Rc<DxvkAdapter>& Adapter) {
|
||||
@ -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) {
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user