Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various cherry picks for 1.10.x round 2 #2912

Merged
merged 6 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions dxvk.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/d3d11/d3d11_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down Expand Up @@ -406,7 +403,6 @@ namespace dxvk {
presenterDesc);

m_presenter->setFrameRateLimit(m_parent->GetOptions()->maxFrameRate);
m_presenter->setFrameRateLimiterRefreshRate(m_displayRefreshRate);

CreateRenderTargetViews();
}
Expand Down
4 changes: 0 additions & 4 deletions src/d3d9/d3d9_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,6 @@ namespace dxvk {
presenterDesc);

m_presenter->setFrameRateLimit(m_parent->GetOptions()->maxFrameRate);
m_presenter->setFrameRateLimiterRefreshRate(m_displayRefreshRate);

CreateRenderTargetViews();
}
Expand Down Expand Up @@ -1182,9 +1181,6 @@ namespace dxvk {
void D3D9SwapChainEx::NotifyDisplayRefreshRate(
double RefreshRate) {
m_displayRefreshRate = RefreshRate;

if (m_presenter != nullptr)
m_presenter->setFrameRateLimiterRefreshRate(RefreshRate);
}


Expand Down
25 changes: 23 additions & 2 deletions src/util/config/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ namespace dxvk {
/* The Vanishing of Ethan Carter Redux */
{ R"(\\EthanCarter-Win64-Shipping\.exe$)", {{
{ "dxgi.customVendorId", "10de" },
}} },
/* EVE Online: Needs this to expose D3D12 *
* otherwise D3D12 option on launcher is *
* greyed out */
{ R"(\\evelauncher\.exe$)", {{
{ "d3d11.maxFeatureLevel", "12_1" },
}} },
/* The Evil Within: Submits command lists *
* multiple times */
Expand Down Expand Up @@ -258,6 +264,10 @@ namespace dxvk {
* use of 4x MSAA throughout the renderer */
{ R"(\\WOFF\.exe$)", {{
{ "d3d11.disableMsaa", "True" },
}} },
/* Mary Skelter 2 - Broken MSAA */
{ R"(\\MarySkelter2\.exe$)", {{
{ "d3d11.disableMsaa", "True" },
}} },
/* Final Fantasy XIV - Stuttering on NV */
{ R"(\\ffxiv_dx11\.exe$)", {{
Expand Down Expand Up @@ -591,9 +601,11 @@ namespace dxvk {
{ "d3d9.customVendorId", "10de" },
}} },
/* Beyond Good And Evil *
* Fixes missing sun and light shafts */
* Fixes missing sun and light shafts *
* UI breaks at high fps */
{ R"(\\BGE\.exe$)", {{
{ "d3d9.allowDoNotWait", "False" },
{ "d3d9.allowDoNotWait", "False" },
{ "d3d9.maxFrameRate", "60" },
}} },
/* Supreme Commander & Forged Alliance Forever */
{ R"(\\(SupremeCommander|ForgedAlliance)\.exe$)", {{
Expand Down Expand Up @@ -622,6 +634,11 @@ namespace dxvk {
{ R"(\\NinjaBlade\.exe$)", {{
{ "d3d9.alphaTestWiggleRoom", "True" },
}} },
/* King Of Fighters XIII *
* In-game speed increases on high FPS */
{ R"(\\kofxiii\.exe$)", {{
{ "d3d9.maxFrameRate", "60" },
}} },
/* YS Origin *
* Helps very bad frametimes in some areas */
{ R"(\\yso_win\.exe$)", {{
Expand All @@ -642,6 +659,10 @@ namespace dxvk {
{ R"(\\SinEpisodes\.exe$)", {{
{ "d3d9.memoryTrackTest", "True" },
}} },
/* Witcher 1: Very long loading times */
{ R"(\\witcher\.exe$)", {{
{ "d3d9.apitraceMode", "True" },
}} },
}};


Expand Down
16 changes: 0 additions & 16 deletions src/util/util_fps_limiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,12 @@ namespace dxvk {
}


void FpsLimiter::setDisplayRefreshRate(double refreshRate) {
std::lock_guard<dxvk::mutex> lock(m_mutex);

m_refreshInterval = refreshRate > 0.0
? NtTimerDuration(int64_t(double(NtTimerDuration::period::den) / refreshRate))
: NtTimerDuration::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();

Expand Down
11 changes: 0 additions & 11 deletions src/util/util_fps_limiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -68,7 +58,6 @@ namespace dxvk {
dxvk::mutex m_mutex;

NtTimerDuration m_targetInterval = NtTimerDuration::zero();
NtTimerDuration m_refreshInterval = NtTimerDuration::zero();
NtTimerDuration m_deviation = NtTimerDuration::zero();
TimePoint m_lastFrame;

Expand Down
5 changes: 0 additions & 5 deletions src/vulkan/vulkan_presenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,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;

Expand Down
10 changes: 0 additions & 10 deletions src/vulkan/vulkan_presenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down