diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.cpp | 10 | ||||
-rw-r--r-- | src/core/core.h | 10 | ||||
-rw-r--r-- | src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp | 2 | ||||
-rw-r--r-- | src/core/perf_stats.cpp | 20 | ||||
-rw-r--r-- | src/core/perf_stats.h | 6 | ||||
-rw-r--r-- | src/core/telemetry_session.cpp | 4 |
6 files changed, 26 insertions, 26 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 15226cf41..d3e84c4ef 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -411,7 +411,7 @@ struct System::Impl { std::string status_details = ""; std::unique_ptr<Core::PerfStats> perf_stats; - Core::FrameLimiter frame_limiter; + Core::SpeedLimiter speed_limiter; bool is_multicore{}; bool is_async_gpu{}; @@ -606,12 +606,12 @@ const Core::PerfStats& System::GetPerfStats() const { return *impl->perf_stats; } -Core::FrameLimiter& System::FrameLimiter() { - return impl->frame_limiter; +Core::SpeedLimiter& System::SpeedLimiter() { + return impl->speed_limiter; } -const Core::FrameLimiter& System::FrameLimiter() const { - return impl->frame_limiter; +const Core::SpeedLimiter& System::SpeedLimiter() const { + return impl->speed_limiter; } Loader::ResultStatus System::GetGameName(std::string& out) const { diff --git a/src/core/core.h b/src/core/core.h index b93c32e60..ea143043c 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -94,7 +94,7 @@ class ARM_Interface; class CpuManager; class DeviceMemory; class ExclusiveMonitor; -class FrameLimiter; +class SpeedLimiter; class PerfStats; class Reporter; class TelemetrySession; @@ -292,11 +292,11 @@ public: /// Provides a constant reference to the internal PerfStats instance. [[nodiscard]] const Core::PerfStats& GetPerfStats() const; - /// Provides a reference to the frame limiter; - [[nodiscard]] Core::FrameLimiter& FrameLimiter(); + /// Provides a reference to the speed limiter; + [[nodiscard]] Core::SpeedLimiter& SpeedLimiter(); - /// Provides a constant referent to the frame limiter - [[nodiscard]] const Core::FrameLimiter& FrameLimiter() const; + /// Provides a constant reference to the speed limiter + [[nodiscard]] const Core::SpeedLimiter& SpeedLimiter() const; /// Gets the name of the current game [[nodiscard]] Loader::ResultStatus GetGameName(std::string& out) const; diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp index 2cc0da124..ce6065db2 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp @@ -54,7 +54,7 @@ void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u3 system.GetPerfStats().EndSystemFrame(); system.GPU().SwapBuffers(&framebuffer); - system.FrameLimiter().DoFrameLimiting(system.CoreTiming().GetGlobalTimeUs()); + system.SpeedLimiter().DoSpeedLimiting(system.CoreTiming().GetGlobalTimeUs()); system.GetPerfStats().BeginSystemFrame(); } diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index 6635a1339..c9ded49d0 100644 --- a/src/core/perf_stats.cpp +++ b/src/core/perf_stats.cpp @@ -127,15 +127,15 @@ double PerfStats::GetLastFrameTimeScale() const { return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH; } -void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) { - if (!Settings::values.use_frame_limit.GetValue() || +void SpeedLimiter::DoSpeedLimiting(microseconds current_system_time_us) { + if (!Settings::values.use_speed_limit.GetValue() || Settings::values.use_multi_core.GetValue()) { return; } auto now = Clock::now(); - const double sleep_scale = Settings::values.frame_limit.GetValue() / 100.0; + const double sleep_scale = Settings::values.speed_limit.GetValue() / 100.0; // Max lag caused by slow frames. Shouldn't be more than the length of a frame at the current // speed percent or it will clamp too much and prevent this from properly limiting to that @@ -143,17 +143,17 @@ void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) { // limiting const microseconds max_lag_time_us = duration_cast<microseconds>( std::chrono::duration<double, std::chrono::microseconds::period>(25ms / sleep_scale)); - frame_limiting_delta_err += duration_cast<microseconds>( + speed_limiting_delta_err += duration_cast<microseconds>( std::chrono::duration<double, std::chrono::microseconds::period>( (current_system_time_us - previous_system_time_us) / sleep_scale)); - frame_limiting_delta_err -= duration_cast<microseconds>(now - previous_walltime); - frame_limiting_delta_err = - std::clamp(frame_limiting_delta_err, -max_lag_time_us, max_lag_time_us); + speed_limiting_delta_err -= duration_cast<microseconds>(now - previous_walltime); + speed_limiting_delta_err = + std::clamp(speed_limiting_delta_err, -max_lag_time_us, max_lag_time_us); - if (frame_limiting_delta_err > microseconds::zero()) { - std::this_thread::sleep_for(frame_limiting_delta_err); + if (speed_limiting_delta_err > microseconds::zero()) { + std::this_thread::sleep_for(speed_limiting_delta_err); auto now_after_sleep = Clock::now(); - frame_limiting_delta_err -= duration_cast<microseconds>(now_after_sleep - now); + speed_limiting_delta_err -= duration_cast<microseconds>(now_after_sleep - now); now = now_after_sleep; } diff --git a/src/core/perf_stats.h b/src/core/perf_stats.h index e5d603717..a2541906f 100644 --- a/src/core/perf_stats.h +++ b/src/core/perf_stats.h @@ -85,11 +85,11 @@ private: double previous_fps = 0; }; -class FrameLimiter { +class SpeedLimiter { public: using Clock = std::chrono::high_resolution_clock; - void DoFrameLimiting(std::chrono::microseconds current_system_time_us); + void DoSpeedLimiting(std::chrono::microseconds current_system_time_us); private: /// Emulated system time (in microseconds) at the last limiter invocation @@ -98,7 +98,7 @@ private: Clock::time_point previous_walltime = Clock::now(); /// Accumulated difference between walltime and emulated time - std::chrono::microseconds frame_limiting_delta_err{0}; + std::chrono::microseconds speed_limiting_delta_err{0}; }; } // namespace Core diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 422de3a7d..5a8cfd301 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -221,8 +221,8 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader, TranslateRenderer(Settings::values.renderer_backend.GetValue())); AddField(field_type, "Renderer_ResolutionFactor", Settings::values.resolution_factor.GetValue()); - AddField(field_type, "Renderer_UseFrameLimit", Settings::values.use_frame_limit.GetValue()); - AddField(field_type, "Renderer_FrameLimit", Settings::values.frame_limit.GetValue()); + AddField(field_type, "Renderer_UseSpeedLimit", Settings::values.use_speed_limit.GetValue()); + AddField(field_type, "Renderer_SpeedLimit", Settings::values.speed_limit.GetValue()); AddField(field_type, "Renderer_UseDiskShaderCache", Settings::values.use_disk_shader_cache.GetValue()); AddField(field_type, "Renderer_GPUAccuracyLevel", |