1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-23 10:54:14 +01:00

[d3d9,d3d11] Adjust flush heuristic on tiling GPUs

Probably needs work, just disable most of the heuristic for the time being.
This commit is contained in:
Philip Rebohle 2025-02-05 19:43:08 +01:00
parent 00299b264b
commit 80fb7e2294
6 changed files with 35 additions and 9 deletions

View File

@ -18,7 +18,7 @@ namespace dxvk {
: D3D11CommonContext<D3D11ImmediateContext>(pParent, Device, 0, DxvkCsChunkFlag::SingleUse), : D3D11CommonContext<D3D11ImmediateContext>(pParent, Device, 0, DxvkCsChunkFlag::SingleUse),
m_csThread(Device, Device->createContext()), m_csThread(Device, Device->createContext()),
m_submissionFence(new sync::CallbackFence()), m_submissionFence(new sync::CallbackFence()),
m_flushTracker(pParent->GetOptions()->reproducibleCommandStream), m_flushTracker(GetMaxFlushType(pParent, Device)),
m_stagingBufferFence(new sync::Fence(0)), m_stagingBufferFence(new sync::Fence(0)),
m_multithread(this, false, pParent->GetOptions()->enableContextLock), m_multithread(this, false, pParent->GetOptions()->enableContextLock),
m_videoContext(this, Device) { m_videoContext(this, Device) {
@ -1074,4 +1074,16 @@ namespace dxvk {
return stats; return stats;
} }
GpuFlushType D3D11ImmediateContext::GetMaxFlushType(
D3D11Device* pParent,
const Rc<DxvkDevice>& Device) {
if (pParent->GetOptions()->reproducibleCommandStream)
return GpuFlushType::ExplicitFlush;
else if (Device->perfHints().preferRenderPassOps)
return GpuFlushType::ImplicitStrongHint;
else
return GpuFlushType::ImplicitWeakHint;
}
} }

View File

@ -208,6 +208,10 @@ namespace dxvk {
DxvkStagingBufferStats GetStagingMemoryStatistics(); DxvkStagingBufferStats GetStagingMemoryStatistics();
static GpuFlushType GetMaxFlushType(
D3D11Device* pParent,
const Rc<DxvkDevice>& Device);
}; };
} }

View File

@ -58,7 +58,7 @@ namespace dxvk {
, m_csThread ( dxvkDevice, dxvkDevice->createContext() ) , m_csThread ( dxvkDevice, dxvkDevice->createContext() )
, m_csChunk ( AllocCsChunk() ) , m_csChunk ( AllocCsChunk() )
, m_submissionFence ( new sync::Fence() ) , m_submissionFence ( new sync::Fence() )
, m_flushTracker ( m_d3d9Options.reproducibleCommandStream ) , m_flushTracker ( GetMaxFlushType() )
, m_d3d9Interop ( this ) , m_d3d9Interop ( this )
, m_d3d9On12 ( this ) , m_d3d9On12 ( this )
, m_d3d8Bridge ( this ) { , m_d3d8Bridge ( this ) {
@ -8731,4 +8731,14 @@ namespace dxvk {
m_flags.clr(D3D9DeviceFlag::DirtySpecializationEntries); m_flags.clr(D3D9DeviceFlag::DirtySpecializationEntries);
} }
GpuFlushType D3D9DeviceEx::GetMaxFlushType() const {
if (m_d3d9Options.reproducibleCommandStream)
return GpuFlushType::ExplicitFlush;
else if (m_dxvkDevice->perfHints().preferRenderPassOps)
return GpuFlushType::ImplicitStrongHint;
else
return GpuFlushType::ImplicitWeakHint;
}
} }

View File

@ -1397,6 +1397,8 @@ namespace dxvk {
&& !m_state.renderTargets[Index]->IsNull(); && !m_state.renderTargets[Index]->IsNull();
} }
GpuFlushType GetMaxFlushType() const;
Com<D3D9InterfaceEx> m_parent; Com<D3D9InterfaceEx> m_parent;
D3DDEVTYPE m_deviceType; D3DDEVTYPE m_deviceType;
HWND m_window; HWND m_window;

View File

@ -2,9 +2,8 @@
namespace dxvk { namespace dxvk {
GpuFlushTracker::GpuFlushTracker( GpuFlushTracker::GpuFlushTracker(GpuFlushType maxType)
bool ensureReproducibleHeuristic) : m_maxType(maxType) {
: m_ensureReproducibleHeuristic(ensureReproducibleHeuristic) {
} }
@ -23,7 +22,7 @@ namespace dxvk {
if (!chunkCount) if (!chunkCount)
return false; return false;
if (m_ensureReproducibleHeuristic && flushType != GpuFlushType::ExplicitFlush) if (flushType > m_maxType)
return false; return false;
// Take any earlier missed flush with a stronger hint into account, so // Take any earlier missed flush with a stronger hint into account, so

View File

@ -34,7 +34,7 @@ namespace dxvk {
public: public:
GpuFlushTracker(bool ensureReproducibleHeuristic); GpuFlushTracker(GpuFlushType maxAllowed);
/** /**
* \brief Checks whether a context flush should be performed * \brief Checks whether a context flush should be performed
@ -63,8 +63,7 @@ namespace dxvk {
private: private:
bool m_ensureReproducibleHeuristic; GpuFlushType m_maxType = GpuFlushType::ImplicitWeakHint;
GpuFlushType m_lastMissedType = GpuFlushType::ImplicitWeakHint; GpuFlushType m_lastMissedType = GpuFlushType::ImplicitWeakHint;
uint64_t m_lastFlushChunkId = 0ull; uint64_t m_lastFlushChunkId = 0ull;