mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-23 10:54:14 +01:00
[d3d11] Ignore explicit flush if there are unresolved render targets
Cursed perf hack for some Unity Engine games.
This commit is contained in:
parent
e31c84640d
commit
10ca8d3ef5
@ -156,6 +156,7 @@ namespace dxvk {
|
|||||||
void STDMETHODCALLTYPE D3D11ImmediateContext::Flush() {
|
void STDMETHODCALLTYPE D3D11ImmediateContext::Flush() {
|
||||||
D3D10DeviceLock lock = LockContext();
|
D3D10DeviceLock lock = LockContext();
|
||||||
|
|
||||||
|
if (!IgnoreExplicitFlush())
|
||||||
ExecuteFlush(GpuFlushType::ExplicitFlush, nullptr, true);
|
ExecuteFlush(GpuFlushType::ExplicitFlush, nullptr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,6 +166,7 @@ namespace dxvk {
|
|||||||
HANDLE hEvent) {
|
HANDLE hEvent) {
|
||||||
D3D10DeviceLock lock = LockContext();
|
D3D10DeviceLock lock = LockContext();
|
||||||
|
|
||||||
|
if (!IgnoreExplicitFlush())
|
||||||
ExecuteFlush(GpuFlushType::ExplicitFlush, hEvent, true);
|
ExecuteFlush(GpuFlushType::ExplicitFlush, hEvent, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1078,6 +1080,22 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool D3D11ImmediateContext::IgnoreExplicitFlush() {
|
||||||
|
// This is sketchy in general since not respecting an explicit flush can
|
||||||
|
// keep resources alive indefinitely when they shouldn't be. Only do this
|
||||||
|
// in tiler mode if flushing would prevent resolve optimizations, and if
|
||||||
|
// we don't break submission order w.r.t. other D3D devices.
|
||||||
|
if (!m_device->perfHints().preferRenderPassOps)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (m_parent->Is11on12Device()
|
||||||
|
|| m_parent->HasSharedResources())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return m_hasPendingMsaaResolve;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GpuFlushType D3D11ImmediateContext::GetMaxFlushType(
|
GpuFlushType D3D11ImmediateContext::GetMaxFlushType(
|
||||||
D3D11Device* pParent,
|
D3D11Device* pParent,
|
||||||
const Rc<DxvkDevice>& Device) {
|
const Rc<DxvkDevice>& Device) {
|
||||||
|
@ -210,6 +210,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
DxvkStagingBufferStats GetStagingMemoryStatistics();
|
DxvkStagingBufferStats GetStagingMemoryStatistics();
|
||||||
|
|
||||||
|
bool IgnoreExplicitFlush();
|
||||||
|
|
||||||
static GpuFlushType GetMaxFlushType(
|
static GpuFlushType GetMaxFlushType(
|
||||||
D3D11Device* pParent,
|
D3D11Device* pParent,
|
||||||
const Rc<DxvkDevice>& Device);
|
const Rc<DxvkDevice>& Device);
|
||||||
|
@ -2375,6 +2375,8 @@ namespace dxvk {
|
|||||||
Logger::err(e.message());
|
Logger::err(e.message());
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_hasSharedResources.store(true, std::memory_order_release);
|
||||||
#else
|
#else
|
||||||
Logger::warn("D3D11Device::OpenSharedResourceGeneric: Not supported on this platform.");
|
Logger::warn("D3D11Device::OpenSharedResourceGeneric: Not supported on this platform.");
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
@ -464,6 +464,10 @@ namespace dxvk {
|
|||||||
|
|
||||||
bool Is11on12Device() const;
|
bool Is11on12Device() const;
|
||||||
|
|
||||||
|
bool HasSharedResources() const {
|
||||||
|
return m_hasSharedResources.load(std::memory_order_acquire);
|
||||||
|
}
|
||||||
|
|
||||||
static D3D_FEATURE_LEVEL GetMaxFeatureLevel(
|
static D3D_FEATURE_LEVEL GetMaxFeatureLevel(
|
||||||
const Rc<DxvkInstance>& Instance,
|
const Rc<DxvkInstance>& Instance,
|
||||||
const Rc<DxvkAdapter>& Adapter);
|
const Rc<DxvkAdapter>& Adapter);
|
||||||
@ -512,6 +516,8 @@ namespace dxvk {
|
|||||||
D3D_FEATURE_LEVEL m_maxFeatureLevel;
|
D3D_FEATURE_LEVEL m_maxFeatureLevel;
|
||||||
D3D11DeviceFeatures m_deviceFeatures;
|
D3D11DeviceFeatures m_deviceFeatures;
|
||||||
|
|
||||||
|
std::atomic<bool> m_hasSharedResources = { false };
|
||||||
|
|
||||||
HRESULT CreateShaderModule(
|
HRESULT CreateShaderModule(
|
||||||
D3D11CommonShader* pShaderModule,
|
D3D11CommonShader* pShaderModule,
|
||||||
DxvkShaderKey ShaderKey,
|
DxvkShaderKey ShaderKey,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user