diff options
| author | Spodi <spodi2290@aol.com> | 2025-04-01 04:38:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-31 23:38:57 -0300 |
| commit | 035a0c08fa411456b0039ddc439e155f295716bd (patch) | |
| tree | e0aec94e1a75e18e9f924af675a51f03c9041075 /src/port/Engine.cpp | |
| parent | b23ad8adf08efb2e49c71dc63657513152c41029 (diff) | |
Unify FPS and V-Sync controls and behavior + Jitterfix change to Checkbox (#182)
* Unify FPS and V-Sync controls and behavior (#181)
- DirectX's "Match Refresh Rate" is now a checkbox like in OpenGL and Metal.
- Clamp max FPS to refresh rate when V-Sync is enabled or can't be disabled, regardless of the FPS sliders setting, to avoid slowdown in Metal / OpenGL and dropping frames in DirectX as much as possible.
-FPS slider allows up to 360 FPS in every renderer.
- More descriptive V-Sync tooltip
Also fixes GetInterpolationFPS() not being used to calculate desired FPS.
* "Jitter Fix" to "Render parallelization" checkbox
Changes the Jitter Fix FPS threshold slider to a simple checkbox named "Render parallelization".
CVar also changed to "gRenderParallelization".
* Fix V-Sync checkbox not representing the default
Diffstat (limited to 'src/port/Engine.cpp')
| -rw-r--r-- | src/port/Engine.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index e0307752..cb5d4ed1 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -480,7 +480,7 @@ void GameEngine::ProcessGfxCommands(Gfx* commands) { wnd->SetRendererUCode(UcodeHandlers::ucode_f3dex); std::vector<std::unordered_map<Mtx*, MtxF>> mtx_replacements; - int target_fps = CVarGetInteger("gInterpolationFPS", 60); + int target_fps = GameEngine::Instance->GetInterpolationFPS(); static int last_fps; static int last_update_rate; static int time; @@ -509,11 +509,9 @@ void GameEngine::ProcessGfxCommands(Gfx* commands) { time -= fps; - int threshold = CVarGetInteger("gExtraLatencyThreshold", 80); - if (wnd != nullptr) { wnd->SetTargetFps(fps); - wnd->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1); + wnd->SetMaximumFrameLatency(CVarGetInteger("gRenderParallelization", 0) ? 2 : 1); } // When the gfx debugger is active, only run with the final mtx @@ -529,16 +527,16 @@ void GameEngine::ProcessGfxCommands(Gfx* commands) { } uint32_t GameEngine::GetInterpolationFPS() { - if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::FAST3D_DXGI_DX11) { - return CVarGetInteger("gInterpolationFPS", 60); - } - if (CVarGetInteger("gMatchRefreshRate", 0)) { return Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); + + } else if (CVarGetInteger("gVsyncEnabled", 1) || + !Ship::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) { + return std::min<uint32_t>(Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(), + CVarGetInteger("gInterpolationFPS", 60)); } - return std::min<uint32_t>(Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(), - CVarGetInteger("gInterpolationFPS", 60)); + return CVarGetInteger("gInterpolationFPS", 60); } uint32_t GameEngine::GetInterpolationFrameCount() |
