diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index 09a91e73c6..5dac3300b5 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -869,6 +869,11 @@ void GLGSRender::on_init_thread() owner->flip(0); } + void refresh() override + { + dlg->refresh(); + } + void close() override { dlg->return_code = CELL_OK; diff --git a/rpcs3/Emu/RSX/Overlays/overlay_controls.h b/rpcs3/Emu/RSX/Overlays/overlay_controls.h index ce33b27bbd..d5eac47e73 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_controls.h +++ b/rpcs3/Emu/RSX/Overlays/overlay_controls.h @@ -1300,12 +1300,7 @@ namespace rsx void set_value(f32 value) { - if (value < 0.f) - m_value = 0.f; - else if (value > m_limit) - m_value = m_limit; - else - m_value = value; + m_value = std::clamp(value, 0.f, m_limit); f32 indicator_width = (w * m_value) / m_limit; indicator.set_size((u16)indicator_width, h); diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index de44fef148..acdbbf0c9d 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -1591,6 +1591,11 @@ void VKGSRender::on_init_thread() owner->flip(0); } + void refresh() override + { + dlg->refresh(); + } + void close() override { dlg->return_code = CELL_OK; diff --git a/rpcs3/Emu/RSX/rsx_cache.h b/rpcs3/Emu/RSX/rsx_cache.h index af4a31cc6b..299d2f93d6 100644 --- a/rpcs3/Emu/RSX/rsx_cache.h +++ b/rpcs3/Emu/RSX/rsx_cache.h @@ -459,6 +459,9 @@ namespace rsx }); } + virtual void refresh() + {}; + virtual void close() {} }; @@ -588,16 +591,21 @@ namespace rsx // Wait for the workers to finish their task while updating UI u32 current_progress = 0; u32 last_update_progress = 0; - do + + while ((current_progress < entry_count) && !Emu.IsStopped()) { std::this_thread::sleep_for(100ms); // Around 10fps should be good enough - current_progress = processed.load(); - - dlg->update_msg(1, current_progress, entry_count); - dlg->inc_value(1, current_progress - last_update_progress); + current_progress = std::min(processed.load(), entry_count); + processed_since_last_update = current_progress - last_update_progress; last_update_progress = current_progress; - } while ((current_progress < entry_count) && !Emu.IsStopped()); + + if (processed_since_last_update > 0) + { + dlg->update_msg(1, current_progress, entry_count); + dlg->inc_value(1, processed_since_last_update); + } + } // Need to join the threads to be absolutely sure shader compilation is done. for (std::thread& worker_thread : worker_threads) @@ -616,7 +624,7 @@ namespace rsx processed_since_last_update++; if ((std::chrono::duration_cast(now - last_update) > 100ms) || (pos == entry_count - 1)) { - dlg->update_msg(1, pos, entry_count); + dlg->update_msg(1, pos + 1, entry_count); dlg->inc_value(1, processed_since_last_update); last_update = now; processed_since_last_update = 0; @@ -634,6 +642,7 @@ namespace rsx LOG_NOTICE(RSX, "shader cache: %d entries were marked as invalid and removed", invalid_entries.size()); } + dlg->refresh(); dlg->close(); }