1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 19:24:12 +01:00

[d3d11] Flush more aggressively on stalling Event queries

Increases GPU utilization in Quake Champions.
This commit is contained in:
Philip Rebohle 2019-05-09 16:38:07 +02:00
parent af45f810b2
commit 45be1dfb53
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 40 additions and 2 deletions

View File

@ -80,17 +80,33 @@ namespace dxvk {
SynchronizeCsThread(); SynchronizeCsThread();
// Get query status directly from the query object // Get query status directly from the query object
HRESULT hr = static_cast<D3D11Query*>(pAsync)->GetData(pData, GetDataFlags); auto query = static_cast<D3D11Query*>(pAsync);
HRESULT hr = query->GetData(pData, GetDataFlags);
// If we're likely going to spin on the asynchronous object, // If we're likely going to spin on the asynchronous object,
// flush the context so that we're keeping the GPU busy // flush the context so that we're keeping the GPU busy
if (hr == S_FALSE) if (hr == S_FALSE) {
query->NotifyStall();
FlushImplicit(FALSE); FlushImplicit(FALSE);
}
return hr; return hr;
} }
void STDMETHODCALLTYPE D3D11ImmediateContext::End(ID3D11Asynchronous* pAsync) {
D3D11DeviceContext::End(pAsync);
auto query = static_cast<D3D11Query*>(pAsync);
if (unlikely(query && query->IsEvent())) {
query->NotifyEnd();
query->IsStalling()
? Flush()
: FlushImplicit(TRUE);
}
}
void STDMETHODCALLTYPE D3D11ImmediateContext::Flush() { void STDMETHODCALLTYPE D3D11ImmediateContext::Flush() {
m_parent->FlushInitContext(); m_parent->FlushInitContext();

View File

@ -32,6 +32,8 @@ namespace dxvk {
UINT DataSize, UINT DataSize,
UINT GetDataFlags); UINT GetDataFlags);
void STDMETHODCALLTYPE End(ID3D11Asynchronous *pAsync);
void STDMETHODCALLTYPE Flush(); void STDMETHODCALLTYPE Flush();
void STDMETHODCALLTYPE ExecuteCommandList( void STDMETHODCALLTYPE ExecuteCommandList(

View File

@ -47,6 +47,23 @@ namespace dxvk {
DxvkBufferSlice GetPredicate(DxvkContext* ctx); DxvkBufferSlice GetPredicate(DxvkContext* ctx);
bool IsEvent() const {
return m_desc.Query == D3D11_QUERY_EVENT;
}
bool IsStalling() const {
return m_stallFlag;
}
void NotifyEnd() {
m_stallMask <<= 1;
}
void NotifyStall() {
m_stallMask |= 1;
m_stallFlag |= bit::popcnt(m_stallMask) >= 16;
}
D3D10Query* GetD3D10Iface() { D3D10Query* GetD3D10Iface() {
return &m_d3d10; return &m_d3d10;
} }
@ -66,6 +83,9 @@ namespace dxvk {
D3D10Query m_d3d10; D3D10Query m_d3d10;
uint32_t m_stallMask = 0;
bool m_stallFlag = false;
UINT64 GetTimestampQueryFrequency() const; UINT64 GetTimestampQueryFrequency() const;
}; };