mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 20:52:10 +01:00
[d3d11] Flush more aggressively when CPU bound
Submitting GPU work early is especially important if there is a CPU<>GPU synchronization point somewhere.
This commit is contained in:
parent
45be1dfb53
commit
a54548dae9
@ -3,8 +3,9 @@
|
||||
#include "d3d11_device.h"
|
||||
#include "d3d11_texture.h"
|
||||
|
||||
constexpr static uint32_t MinFlushIntervalUs = 1250;
|
||||
constexpr static uint32_t MaxPendingSubmits = 3;
|
||||
constexpr static uint32_t MinFlushIntervalUs = 750;
|
||||
constexpr static uint32_t IncFlushIntervalUs = 250;
|
||||
constexpr static uint32_t MaxPendingSubmits = 6;
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
@ -553,11 +554,16 @@ namespace dxvk {
|
||||
void D3D11ImmediateContext::FlushImplicit(BOOL StrongHint) {
|
||||
// Flush only if the GPU is about to go idle, in
|
||||
// order to keep the number of submissions low.
|
||||
if (StrongHint || m_device->pendingSubmissions() <= MaxPendingSubmits) {
|
||||
uint32_t pending = m_device->pendingSubmissions();
|
||||
|
||||
if (StrongHint || pending <= MaxPendingSubmits) {
|
||||
auto now = std::chrono::high_resolution_clock::now();
|
||||
|
||||
uint32_t delay = MinFlushIntervalUs
|
||||
+ IncFlushIntervalUs * pending;
|
||||
|
||||
// Prevent flushing too often in short intervals.
|
||||
if (now - m_lastFlush >= std::chrono::microseconds(MinFlushIntervalUs))
|
||||
if (now - m_lastFlush >= std::chrono::microseconds(delay))
|
||||
Flush();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user