mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 01:08:56 +02:00
[android] Linked Frame Time Cadence to Quantized Frames
This commit is contained in:
parent
8c79a3a8de
commit
5bce1993e1
2 changed files with 26 additions and 0 deletions
|
|
@ -116,8 +116,29 @@ float EmuWindow_Android::QuantizeFrameRateHint(float frame_rate) {
|
|||
return std::fabs(frame_rate - best_rate) <= tolerance ? best_rate : best_rate;
|
||||
}
|
||||
|
||||
float EmuWindow_Android::GetFrameTimeVerifiedHint() const {
|
||||
if (!EmulationSession::GetInstance().IsRunning()) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
const double frame_time_scale =
|
||||
EmulationSession::GetInstance().System().GetPerfStats().GetLastFrameTimeScale();
|
||||
if (!std::isfinite(frame_time_scale) || frame_time_scale <= 0.0) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
const float verified_rate =
|
||||
std::clamp(60.0f / static_cast<float>(frame_time_scale), 0.0f, 240.0f);
|
||||
const float verified_hint = QuantizeFrameRateHint(verified_rate);
|
||||
|
||||
// Frame-time verification is most useful to separate stable 30/60 FPS content.
|
||||
return verified_hint <= 60.0f ? verified_hint : 0.0f;
|
||||
}
|
||||
|
||||
float EmuWindow_Android::GetFrameRateHint() const {
|
||||
const float observed_rate = std::clamp(m_smoothed_present_rate, 0.0f, 240.0f);
|
||||
const float frame_time_verified_hint = GetFrameTimeVerifiedHint();
|
||||
|
||||
if (m_last_frame_rate_hint > 0.0f && observed_rate > 0.0f) {
|
||||
const float tolerance = std::max(m_last_frame_rate_hint * 0.12f, 4.0f);
|
||||
if (std::fabs(observed_rate - m_last_frame_rate_hint) <= tolerance) {
|
||||
|
|
@ -125,6 +146,10 @@ float EmuWindow_Android::GetFrameRateHint() const {
|
|||
}
|
||||
}
|
||||
|
||||
if (frame_time_verified_hint > 0.0f) {
|
||||
return frame_time_verified_hint;
|
||||
}
|
||||
|
||||
const float observed_hint = QuantizeFrameRateHint(observed_rate);
|
||||
if (observed_hint > 0.0f) {
|
||||
return observed_hint;
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ private:
|
|||
void UpdateFrameRateHint();
|
||||
void UpdateObservedFrameRate();
|
||||
[[nodiscard]] float GetFrameRateHint() const;
|
||||
[[nodiscard]] float GetFrameTimeVerifiedHint() const;
|
||||
[[nodiscard]] static float QuantizeFrameRateHint(float frame_rate);
|
||||
|
||||
float m_window_width{};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue