mirror of
https://github.com/stenzek/duckstation.git
synced 2026-07-08 17:46:19 +00:00
GPUDevice: Use separate variables for last/next present time
Fixes erratic frame rates in Big Picture mode.
Regression from 09926a3769.
This commit is contained in:
@@ -3581,7 +3581,7 @@ static void DemoWindowWidgetsText()
|
||||
static float custom_size = 16.0f;
|
||||
ImGui::SliderFloat("custom_size", &custom_size, 10.0f, 100.0f, "%.0f");
|
||||
ImGui::Text("ImGui::PushFont(nullptr, custom_size);");
|
||||
ImGui::PushFont(NULL, custom_size);
|
||||
ImGui::PushFont(NULL, custom_size, -1.0f);
|
||||
ImGui::Text("FontSize = %.2f (== %.2f * global_scale)", ImGui::GetFontSize(), custom_size);
|
||||
ImGui::PopFont();
|
||||
|
||||
@@ -3589,14 +3589,14 @@ static void DemoWindowWidgetsText()
|
||||
static float custom_scale = 1.0f;
|
||||
ImGui::SliderFloat("custom_scale", &custom_scale, 0.5f, 4.0f, "%.2f");
|
||||
ImGui::Text("ImGui::PushFont(nullptr, style.FontSizeBase * custom_scale);");
|
||||
ImGui::PushFont(NULL, style.FontSizeBase * custom_scale);
|
||||
ImGui::PushFont(NULL, style.FontSizeBase * custom_scale, -1.0f);
|
||||
ImGui::Text("FontSize = %.2f (== style.FontSizeBase * %.2f * global_scale)", ImGui::GetFontSize(), custom_scale);
|
||||
ImGui::PopFont();
|
||||
|
||||
ImGui::SeparatorText("");
|
||||
for (float scaling = 0.5f; scaling <= 4.0f; scaling += 0.5f)
|
||||
{
|
||||
ImGui::PushFont(NULL, style.FontSizeBase * scaling);
|
||||
ImGui::PushFont(NULL, style.FontSizeBase * scaling, -1.0f);
|
||||
ImGui::Text("FontSize = %.2f (== style.FontSizeBase * %.2f * global_scale)", ImGui::GetFontSize(), scaling);
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
@@ -1039,6 +1039,14 @@ void FullscreenUI::EndLayout()
|
||||
s_state.progress_dialog.Draw();
|
||||
s_state.message_dialog.Draw();
|
||||
|
||||
#if 0
|
||||
if (HasActiveWindow())
|
||||
{
|
||||
s_state.left_fullscreen_footer_text.append_format("FPS: {:.2f} ({:.3f} ms)", GImGui->IO.Framerate,
|
||||
1000.0f / GImGui->IO.Framerate);
|
||||
}
|
||||
#endif
|
||||
|
||||
DrawFullscreenFooter();
|
||||
|
||||
PopResetLayout();
|
||||
|
||||
@@ -319,12 +319,12 @@ void GPUSwapChain::ThrottlePresentation()
|
||||
// Allow it to fall behind/run ahead up to 2*period. Sleep isn't that precise, plus we need to
|
||||
// allow time for the actual rendering.
|
||||
const u64 max_variance = sleep_period * 2;
|
||||
if (static_cast<u64>(std::abs(static_cast<s64>(current_ts - m_last_frame_displayed_time))) > max_variance)
|
||||
m_last_frame_displayed_time = current_ts + sleep_period;
|
||||
if (static_cast<u64>(std::abs(static_cast<s64>(current_ts - m_next_throttle_time))) > max_variance)
|
||||
m_next_throttle_time = current_ts + sleep_period;
|
||||
else
|
||||
m_last_frame_displayed_time += sleep_period;
|
||||
m_next_throttle_time += sleep_period;
|
||||
|
||||
Timer::SleepUntil(m_last_frame_displayed_time, false);
|
||||
Timer::SleepUntil(m_next_throttle_time, false);
|
||||
}
|
||||
|
||||
GPUDevice::GPUDevice()
|
||||
|
||||
@@ -502,6 +502,7 @@ protected:
|
||||
bool m_allow_present_throttle = false;
|
||||
|
||||
u64 m_last_frame_displayed_time = 0;
|
||||
u64 m_next_throttle_time = 0;
|
||||
};
|
||||
|
||||
class GPUDevice
|
||||
|
||||
Reference in New Issue
Block a user