mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 20:52:10 +01:00
[dxvk] Don't disable frame rate limiter if vsync is enabled
This only works if we know the actual refresh rate of the display. However, in a wine virtual desktop or with proton's fshack, this is often not the case, so we'd see a 60 Hz mode on a high-refresh rate display and never actually enable the limiter.
This commit is contained in:
parent
04bc1bac73
commit
61025c0079
@ -19,9 +19,10 @@
|
||||
# d3d9.maxFrameLatency = 0
|
||||
|
||||
|
||||
# Enables a frame rate limiter, unless the game is already
|
||||
# limited to the same refresh rate by vertical synchronization.
|
||||
#
|
||||
# Enables frame rate limiter. The main purpose of this is to work around
|
||||
# bugs in games that have physics or other simulation tied to their frame
|
||||
# rate, but do not provide their own limiter.
|
||||
#
|
||||
# Supported values : Any non-negative integer
|
||||
|
||||
# dxgi.maxFrameRate = 0
|
||||
|
@ -252,9 +252,6 @@ namespace dxvk {
|
||||
DXGI_RATIONAL rate = pDisplayMode->RefreshRate;
|
||||
m_displayRefreshRate = double(rate.Numerator) / double(rate.Denominator);
|
||||
}
|
||||
|
||||
if (m_presenter != nullptr)
|
||||
m_presenter->setFrameRateLimiterRefreshRate(m_displayRefreshRate);
|
||||
}
|
||||
|
||||
|
||||
@ -407,7 +404,6 @@ namespace dxvk {
|
||||
presenterDesc);
|
||||
|
||||
m_presenter->setFrameRateLimit(m_parent->GetOptions()->maxFrameRate);
|
||||
m_presenter->setFrameRateLimiterRefreshRate(m_displayRefreshRate);
|
||||
|
||||
CreateRenderTargetViews();
|
||||
}
|
||||
|
@ -798,7 +798,6 @@ namespace dxvk {
|
||||
presenterDesc);
|
||||
|
||||
m_presenter->setFrameRateLimit(m_parent->GetOptions()->maxFrameRate);
|
||||
m_presenter->setFrameRateLimiterRefreshRate(m_displayRefreshRate);
|
||||
|
||||
CreateRenderTargetViews();
|
||||
}
|
||||
@ -1026,9 +1025,6 @@ namespace dxvk {
|
||||
void D3D9SwapChainEx::NotifyDisplayRefreshRate(
|
||||
double RefreshRate) {
|
||||
m_displayRefreshRate = RefreshRate;
|
||||
|
||||
if (m_presenter != nullptr)
|
||||
m_presenter->setFrameRateLimiterRefreshRate(RefreshRate);
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,28 +44,12 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void FpsLimiter::setDisplayRefreshRate(double refreshRate) {
|
||||
std::lock_guard<dxvk::mutex> lock(m_mutex);
|
||||
|
||||
m_refreshInterval = refreshRate > 0.0
|
||||
? TimerDuration(int64_t(double(TimerDuration::period::den) / refreshRate))
|
||||
: TimerDuration::zero();
|
||||
}
|
||||
|
||||
|
||||
void FpsLimiter::delay(bool vsyncEnabled) {
|
||||
std::lock_guard<dxvk::mutex> lock(m_mutex);
|
||||
|
||||
if (!isEnabled())
|
||||
return;
|
||||
|
||||
// If the swap chain is known to have vsync enabled and the
|
||||
// refresh rate is similar to the target frame rate, disable
|
||||
// the limiter so it does not screw up frame times
|
||||
if (vsyncEnabled && !m_envOverride
|
||||
&& m_refreshInterval * 100 > m_targetInterval * 97)
|
||||
return;
|
||||
|
||||
auto t0 = m_lastFrame;
|
||||
auto t1 = dxvk::high_resolution_clock::now();
|
||||
|
||||
|
@ -28,16 +28,6 @@ namespace dxvk {
|
||||
*/
|
||||
void setTargetFrameRate(double frameRate);
|
||||
|
||||
/**
|
||||
* \brief Sets display refresh rate
|
||||
*
|
||||
* This information is used to decide whether or not
|
||||
* the limiter should be active in the first place in
|
||||
* case vertical synchronization is enabled.
|
||||
* \param [in] refreshRate Current refresh rate
|
||||
*/
|
||||
void setDisplayRefreshRate(double refreshRate);
|
||||
|
||||
/**
|
||||
* \brief Stalls calling thread as necessary
|
||||
*
|
||||
@ -75,7 +65,6 @@ namespace dxvk {
|
||||
dxvk::mutex m_mutex;
|
||||
|
||||
TimerDuration m_targetInterval = TimerDuration::zero();
|
||||
TimerDuration m_refreshInterval = TimerDuration::zero();
|
||||
TimerDuration m_deviation = TimerDuration::zero();
|
||||
TimePoint m_lastFrame;
|
||||
|
||||
|
@ -232,11 +232,6 @@ namespace dxvk::vk {
|
||||
}
|
||||
|
||||
|
||||
void Presenter::setFrameRateLimiterRefreshRate(double refreshRate) {
|
||||
m_fpsLimiter.setDisplayRefreshRate(refreshRate);
|
||||
}
|
||||
|
||||
|
||||
VkResult Presenter::getSupportedFormats(std::vector<VkSurfaceFormatKHR>& formats, const PresenterDesc& desc) {
|
||||
uint32_t numFormats = 0;
|
||||
|
||||
|
@ -161,16 +161,6 @@ namespace dxvk::vk {
|
||||
*/
|
||||
void setFrameRateLimit(double frameRate);
|
||||
|
||||
/**
|
||||
* \brief Notifies frame rate limiter about the display refresh rate
|
||||
*
|
||||
* Used to dynamically disable the frame rate limiter in case
|
||||
* vertical synchronization is used and the target frame rate
|
||||
* roughly equals the display's refresh rate.
|
||||
* \param [in] refresnRate Current refresh rate
|
||||
*/
|
||||
void setFrameRateLimiterRefreshRate(double refreshRate);
|
||||
|
||||
/**
|
||||
* \brief Checks whether a Vulkan swap chain exists
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user