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 { | |||
| 411 | std::string status_details = ""; | 411 | std::string status_details = ""; |
| 412 | 412 | ||
| 413 | std::unique_ptr<Core::PerfStats> perf_stats; | 413 | std::unique_ptr<Core::PerfStats> perf_stats; |
| 414 | Core::FrameLimiter frame_limiter; | 414 | Core::SpeedLimiter speed_limiter; |
| 415 | 415 | ||
| 416 | bool is_multicore{}; | 416 | bool is_multicore{}; |
| 417 | bool is_async_gpu{}; | 417 | bool is_async_gpu{}; |
| @@ -606,12 +606,12 @@ const Core::PerfStats& System::GetPerfStats() const { | |||
| 606 | return *impl->perf_stats; | 606 | return *impl->perf_stats; |
| 607 | } | 607 | } |
| 608 | 608 | ||
| 609 | Core::FrameLimiter& System::FrameLimiter() { | 609 | Core::SpeedLimiter& System::SpeedLimiter() { |
| 610 | return impl->frame_limiter; | 610 | return impl->speed_limiter; |
| 611 | } | 611 | } |
| 612 | 612 | ||
| 613 | const Core::FrameLimiter& System::FrameLimiter() const { | 613 | const Core::SpeedLimiter& System::SpeedLimiter() const { |
| 614 | return impl->frame_limiter; | 614 | return impl->speed_limiter; |
| 615 | } | 615 | } |
| 616 | 616 | ||
| 617 | Loader::ResultStatus System::GetGameName(std::string& out) const { | 617 | 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; | |||
| 94 | class CpuManager; | 94 | class CpuManager; |
| 95 | class DeviceMemory; | 95 | class DeviceMemory; |
| 96 | class ExclusiveMonitor; | 96 | class ExclusiveMonitor; |
| 97 | class FrameLimiter; | 97 | class SpeedLimiter; |
| 98 | class PerfStats; | 98 | class PerfStats; |
| 99 | class Reporter; | 99 | class Reporter; |
| 100 | class TelemetrySession; | 100 | class TelemetrySession; |
| @@ -292,11 +292,11 @@ public: | |||
| 292 | /// Provides a constant reference to the internal PerfStats instance. | 292 | /// Provides a constant reference to the internal PerfStats instance. |
| 293 | [[nodiscard]] const Core::PerfStats& GetPerfStats() const; | 293 | [[nodiscard]] const Core::PerfStats& GetPerfStats() const; |
| 294 | 294 | ||
| 295 | /// Provides a reference to the frame limiter; | 295 | /// Provides a reference to the speed limiter; |
| 296 | [[nodiscard]] Core::FrameLimiter& FrameLimiter(); | 296 | [[nodiscard]] Core::SpeedLimiter& SpeedLimiter(); |
| 297 | 297 | ||
| 298 | /// Provides a constant referent to the frame limiter | 298 | /// Provides a constant reference to the speed limiter |
| 299 | [[nodiscard]] const Core::FrameLimiter& FrameLimiter() const; | 299 | [[nodiscard]] const Core::SpeedLimiter& SpeedLimiter() const; |
| 300 | 300 | ||
| 301 | /// Gets the name of the current game | 301 | /// Gets the name of the current game |
| 302 | [[nodiscard]] Loader::ResultStatus GetGameName(std::string& out) const; | 302 | [[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 | |||
| 54 | 54 | ||
| 55 | system.GetPerfStats().EndSystemFrame(); | 55 | system.GetPerfStats().EndSystemFrame(); |
| 56 | system.GPU().SwapBuffers(&framebuffer); | 56 | system.GPU().SwapBuffers(&framebuffer); |
| 57 | system.FrameLimiter().DoFrameLimiting(system.CoreTiming().GetGlobalTimeUs()); | 57 | system.SpeedLimiter().DoSpeedLimiting(system.CoreTiming().GetGlobalTimeUs()); |
| 58 | system.GetPerfStats().BeginSystemFrame(); | 58 | system.GetPerfStats().BeginSystemFrame(); |
| 59 | } | 59 | } |
| 60 | 60 | ||
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 { | |||
| 127 | return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH; | 127 | return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) { | 130 | void SpeedLimiter::DoSpeedLimiting(microseconds current_system_time_us) { |
| 131 | if (!Settings::values.use_frame_limit.GetValue() || | 131 | if (!Settings::values.use_speed_limit.GetValue() || |
| 132 | Settings::values.use_multi_core.GetValue()) { | 132 | Settings::values.use_multi_core.GetValue()) { |
| 133 | return; | 133 | return; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | auto now = Clock::now(); | 136 | auto now = Clock::now(); |
| 137 | 137 | ||
| 138 | const double sleep_scale = Settings::values.frame_limit.GetValue() / 100.0; | 138 | const double sleep_scale = Settings::values.speed_limit.GetValue() / 100.0; |
| 139 | 139 | ||
| 140 | // Max lag caused by slow frames. Shouldn't be more than the length of a frame at the current | 140 | // Max lag caused by slow frames. Shouldn't be more than the length of a frame at the current |
| 141 | // speed percent or it will clamp too much and prevent this from properly limiting to that | 141 | // 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) { | |||
| 143 | // limiting | 143 | // limiting |
| 144 | const microseconds max_lag_time_us = duration_cast<microseconds>( | 144 | const microseconds max_lag_time_us = duration_cast<microseconds>( |
| 145 | std::chrono::duration<double, std::chrono::microseconds::period>(25ms / sleep_scale)); | 145 | std::chrono::duration<double, std::chrono::microseconds::period>(25ms / sleep_scale)); |
| 146 | frame_limiting_delta_err += duration_cast<microseconds>( | 146 | speed_limiting_delta_err += duration_cast<microseconds>( |
| 147 | std::chrono::duration<double, std::chrono::microseconds::period>( | 147 | std::chrono::duration<double, std::chrono::microseconds::period>( |
| 148 | (current_system_time_us - previous_system_time_us) / sleep_scale)); | 148 | (current_system_time_us - previous_system_time_us) / sleep_scale)); |
| 149 | frame_limiting_delta_err -= duration_cast<microseconds>(now - previous_walltime); | 149 | speed_limiting_delta_err -= duration_cast<microseconds>(now - previous_walltime); |
| 150 | frame_limiting_delta_err = | 150 | speed_limiting_delta_err = |
| 151 | std::clamp(frame_limiting_delta_err, -max_lag_time_us, max_lag_time_us); | 151 | std::clamp(speed_limiting_delta_err, -max_lag_time_us, max_lag_time_us); |
| 152 | 152 | ||
| 153 | if (frame_limiting_delta_err > microseconds::zero()) { | 153 | if (speed_limiting_delta_err > microseconds::zero()) { |
| 154 | std::this_thread::sleep_for(frame_limiting_delta_err); | 154 | std::this_thread::sleep_for(speed_limiting_delta_err); |
| 155 | auto now_after_sleep = Clock::now(); | 155 | auto now_after_sleep = Clock::now(); |
| 156 | frame_limiting_delta_err -= duration_cast<microseconds>(now_after_sleep - now); | 156 | speed_limiting_delta_err -= duration_cast<microseconds>(now_after_sleep - now); |
| 157 | now = now_after_sleep; | 157 | now = now_after_sleep; |
| 158 | } | 158 | } |
| 159 | 159 | ||
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: | |||
| 85 | double previous_fps = 0; | 85 | double previous_fps = 0; |
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| 88 | class FrameLimiter { | 88 | class SpeedLimiter { |
| 89 | public: | 89 | public: |
| 90 | using Clock = std::chrono::high_resolution_clock; | 90 | using Clock = std::chrono::high_resolution_clock; |
| 91 | 91 | ||
| 92 | void DoFrameLimiting(std::chrono::microseconds current_system_time_us); | 92 | void DoSpeedLimiting(std::chrono::microseconds current_system_time_us); |
| 93 | 93 | ||
| 94 | private: | 94 | private: |
| 95 | /// Emulated system time (in microseconds) at the last limiter invocation | 95 | /// Emulated system time (in microseconds) at the last limiter invocation |
| @@ -98,7 +98,7 @@ private: | |||
| 98 | Clock::time_point previous_walltime = Clock::now(); | 98 | Clock::time_point previous_walltime = Clock::now(); |
| 99 | 99 | ||
| 100 | /// Accumulated difference between walltime and emulated time | 100 | /// Accumulated difference between walltime and emulated time |
| 101 | std::chrono::microseconds frame_limiting_delta_err{0}; | 101 | std::chrono::microseconds speed_limiting_delta_err{0}; |
| 102 | }; | 102 | }; |
| 103 | 103 | ||
| 104 | } // namespace Core | 104 | } // namespace Core |
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 066cb23e4..d81f6ddbd 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp | |||
| @@ -221,8 +221,8 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader, | |||
| 221 | TranslateRenderer(Settings::values.renderer_backend.GetValue())); | 221 | TranslateRenderer(Settings::values.renderer_backend.GetValue())); |
| 222 | AddField(field_type, "Renderer_ResolutionFactor", | 222 | AddField(field_type, "Renderer_ResolutionFactor", |
| 223 | Settings::values.resolution_factor.GetValue()); | 223 | Settings::values.resolution_factor.GetValue()); |
| 224 | AddField(field_type, "Renderer_UseFrameLimit", Settings::values.use_frame_limit.GetValue()); | 224 | AddField(field_type, "Renderer_UseSpeedLimit", Settings::values.use_speed_limit.GetValue()); |
| 225 | AddField(field_type, "Renderer_FrameLimit", Settings::values.frame_limit.GetValue()); | 225 | AddField(field_type, "Renderer_SpeedLimit", Settings::values.speed_limit.GetValue()); |
| 226 | AddField(field_type, "Renderer_UseDiskShaderCache", | 226 | AddField(field_type, "Renderer_UseDiskShaderCache", |
| 227 | Settings::values.use_disk_shader_cache.GetValue()); | 227 | Settings::values.use_disk_shader_cache.GetValue()); |
| 228 | AddField(field_type, "Renderer_GPUAccuracyLevel", | 228 | AddField(field_type, "Renderer_GPUAccuracyLevel", |