[d3d11] Flush implicitly when GetData returns S_FALSE

Keeps the GPU busy when spinning on a query and ensures that we're
flushing at some point. Replaces the Fallout 4 hang workaround.
This commit is contained in:
Philip Rebohle 2018-06-08 13:11:24 +02:00
parent a2df1ea4c9
commit d4cb5115e7
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
1 changed files with 19 additions and 8 deletions

View File

@ -73,16 +73,26 @@ namespace dxvk {
if ((GetDataFlags & D3D11_ASYNC_GETDATA_DONOTFLUSH) == 0)
Flush();
// This method handles various different but incompatible interfaces,
// Default error return for unsupported interfaces
HRESULT hr = E_INVALIDARG;
// This method can handle various incompatible interfaces,
// so we have to find out what we are actually dealing with
Com<ID3D11Query> query;
if (SUCCEEDED(pAsync->QueryInterface(__uuidof(ID3D11Query), reinterpret_cast<void**>(&query))))
return static_cast<D3D11Query*>(query.ptr())->GetData(pData, GetDataFlags);
hr = static_cast<D3D11Query*>(query.ptr())->GetData(pData, GetDataFlags);
// The interface is not supported
Logger::err("D3D11: GetData: Unsupported Async type");
return E_INVALIDARG;
// If we're likely going to spin on the asynchronous object,
// flush the context so that we're keeping the GPU busy
if (hr == S_FALSE)
FlushImplicit();
// The requested interface is not supported
if (FAILED(hr))
Logger::err("D3D11: GetData: Unsupported Async type");
return hr;
}
@ -103,10 +113,11 @@ namespace dxvk {
FlushCsChunk();
// Reset optimization info
m_csIsBusy = false;
m_lastFlush = std::chrono::high_resolution_clock::now();
}
// Reset optimization info
m_csIsBusy = false;
m_lastFlush = std::chrono::high_resolution_clock::now();
}