GPU/HW: Simplify shader compile progress updates

This commit is contained in:
Connor McLaughlin
2021-07-11 13:21:41 +10:00
parent 98af6e7228
commit 096a92ba84
6 changed files with 84 additions and 107 deletions

View File

@ -1464,3 +1464,22 @@ void GPU_HW::DrawRendererStats(bool is_idle_frame)
}
#endif
}
GPU_HW::ShaderCompileProgressTracker::ShaderCompileProgressTracker(std::string title, u32 total)
: m_title(std::move(title)), m_min_time(Common::Timer::ConvertSecondsToValue(1.0)),
m_update_interval(Common::Timer::ConvertSecondsToValue(0.1)), m_start_time(Common::Timer::GetValue()),
m_last_update_time(0), m_progress(0), m_total(total)
{
}
void GPU_HW::ShaderCompileProgressTracker::Increment()
{
m_progress++;
const u64 tv = Common::Timer::GetValue();
if ((tv - m_start_time) >= m_min_time && (tv - m_last_update_time) >= m_update_interval)
{
g_host_interface->DisplayLoadingScreen(m_title.c_str(), 0, static_cast<int>(m_total), static_cast<int>(m_progress));
m_last_update_time = tv;
}
}