summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar ameerj2021-07-22 19:56:21 -0400
committerGravatar ameerj2021-07-23 22:10:01 -0400
commit9dfbc9bdce15c299faf06aa7bf68a8660366daee (patch)
tree83ae648f51b4d0d2bb484741f86f5fb9bce8d00b /src/core
parentMerge pull request #6686 from ReinUsesLisp/vk-optimal-copy (diff)
downloadyuzu-9dfbc9bdce15c299faf06aa7bf68a8660366daee.tar.gz
yuzu-9dfbc9bdce15c299faf06aa7bf68a8660366daee.tar.xz
yuzu-9dfbc9bdce15c299faf06aa7bf68a8660366daee.zip
general: Rename "Frame Limit" references to "Speed Limit"
This setting is best referred to as a speed limit, as it involves the limits of all timing based aspects of the emulator, not only framerate. This allows us to differentiate it from the fps unlocker setting.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.cpp10
-rw-r--r--src/core/core.h10
-rw-r--r--src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp2
-rw-r--r--src/core/perf_stats.cpp20
-rw-r--r--src/core/perf_stats.h6
-rw-r--r--src/core/telemetry_session.cpp4
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
609Core::FrameLimiter& System::FrameLimiter() { 609Core::SpeedLimiter& System::SpeedLimiter() {
610 return impl->frame_limiter; 610 return impl->speed_limiter;
611} 611}
612 612
613const Core::FrameLimiter& System::FrameLimiter() const { 613const Core::SpeedLimiter& System::SpeedLimiter() const {
614 return impl->frame_limiter; 614 return impl->speed_limiter;
615} 615}
616 616
617Loader::ResultStatus System::GetGameName(std::string& out) const { 617Loader::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;
94class CpuManager; 94class CpuManager;
95class DeviceMemory; 95class DeviceMemory;
96class ExclusiveMonitor; 96class ExclusiveMonitor;
97class FrameLimiter; 97class SpeedLimiter;
98class PerfStats; 98class PerfStats;
99class Reporter; 99class Reporter;
100class TelemetrySession; 100class 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
130void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) { 130void 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
88class FrameLimiter { 88class SpeedLimiter {
89public: 89public:
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
94private: 94private:
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",