[d3d11] Add frame rate limiter and dxgi.maxFrameRate option

This commit is contained in:
Philip Rebohle 2021-06-09 03:46:12 +02:00 committed by Philip Rebohle
parent 4f5f85925b
commit 8b67ef724e
5 changed files with 10 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#
# Supported values : Any non-negative integer
# dxgi.maxFrameRate = 0
# d3d9.maxFrameRate = 0

View File

@ -19,6 +19,7 @@ namespace dxvk {
this->deferSurfaceCreation = config.getOption<bool>("dxgi.deferSurfaceCreation", false);
this->numBackBuffers = config.getOption<int32_t>("dxgi.numBackBuffers", 0);
this->maxFrameLatency = config.getOption<int32_t>("dxgi.maxFrameLatency", 0);
this->maxFrameRate = config.getOption<int32_t>("dxgi.maxFrameRate", 0);
this->syncInterval = config.getOption<int32_t>("dxgi.syncInterval", -1);
this->tearFree = config.getOption<Tristate>("dxgi.tearFree", Tristate::Auto);

View File

@ -83,6 +83,9 @@ namespace dxvk {
/// a higher value. May help with frame timing issues.
int32_t maxFrameLatency;
/// Limit frame rate
int32_t maxFrameRate;
/// Defer surface creation until first present call. This
/// fixes issues with games that create multiple swap chains
/// for a single window that may interfere with each other.

View File

@ -380,6 +380,9 @@ namespace dxvk {
presenterDevice,
presenterDesc);
m_presenter->setFrameRateLimit(m_parent->GetOptions()->maxFrameRate);
m_presenter->setFrameRateLimiterRefreshRate(m_displayRefreshRate);
CreateRenderTargetViews();
}

View File

@ -108,6 +108,8 @@ namespace dxvk {
bool m_dirty = true;
bool m_vsync = true;
double m_displayRefreshRate = 0.0;
HRESULT PresentImage(UINT SyncInterval);
void SubmitPresent(