PPU Progress Hint: Show it as long as it needs

This commit is contained in:
Elad Ashkenazi 2024-05-30 09:42:44 +03:00
parent 8fa23436f9
commit 67893fb8f8
5 changed files with 42 additions and 7 deletions

View file

@ -27,7 +27,7 @@ namespace rsx
true); true);
} }
void show_ppu_compile_notification() std::shared_ptr<atomic_t<u32>> show_ppu_compile_notification()
{ {
if (!s_ppu_loading_icon24) if (!s_ppu_loading_icon24)
{ {
@ -35,13 +35,17 @@ namespace rsx
s_ppu_loading_icon24 = std::make_shared<loading_icon24>(); s_ppu_loading_icon24 = std::make_shared<loading_icon24>();
} }
std::shared_ptr<atomic_t<u32>> refs = std::make_shared<atomic_t<u32>>(1);
queue_message( queue_message(
localized_string_id::RSX_OVERLAYS_COMPILING_PPU_MODULES, localized_string_id::RSX_OVERLAYS_COMPILING_PPU_MODULES,
5'000'000, 20'000'000,
{}, refs,
message_pin_location::bottom, message_pin_location::bottom,
s_ppu_loading_icon24, s_ppu_loading_icon24,
true); true);
return refs;
} }
} }
} }

View file

@ -1,10 +1,13 @@
#pragma once #pragma once
#include "util/types.hpp"
#include "util/atomic.hpp"
namespace rsx namespace rsx
{ {
namespace overlays namespace overlays
{ {
void show_shader_compile_notification(); void show_shader_compile_notification();
void show_ppu_compile_notification(); std::shared_ptr<atomic_t<u32>> show_ppu_compile_notification();
} }
} }

View file

@ -66,6 +66,15 @@ namespace rsx
return m_refs && *m_refs == 0 ? 0 : m_expiration_time; return m_refs && *m_refs == 0 ? 0 : m_expiration_time;
} }
void message_item::ensure_expired()
{
// If reference counting is enabled and reached 0 consider it expired
if (m_refs)
{
*m_refs = 0;
}
}
bool message_item::text_matches(const std::u32string& text) const bool message_item::text_matches(const std::u32string& text) const
{ {
return m_text.text == text; return m_text.text == text;
@ -165,6 +174,8 @@ namespace rsx
{ {
if (it->get_expiration() < cur_time) if (it->get_expiration() < cur_time)
{ {
// Enusre reference counter is updated on timeout
it->ensure_expired();
it = vis_set.erase(it); it = vis_set.erase(it);
} }
else else

View file

@ -25,6 +25,7 @@ namespace rsx
void reset_expiration(); void reset_expiration();
u64 get_expiration() const; u64 get_expiration() const;
void ensure_expired();
compiled_resource& get_compiled() override; compiled_resource& get_compiled() override;
bool text_matches(const std::u32string& text) const; bool text_matches(const std::u32string& text) const;

View file

@ -169,6 +169,8 @@ void progress_dialog_server::operator()()
const u64 start_time = get_system_time(); const u64 start_time = get_system_time();
u64 wait_no_update_count = 0; u64 wait_no_update_count = 0;
std::shared_ptr<atomic_t<u32>> ppu_cue_refs;
// Update progress // Update progress
while (!g_system_progress_stopping && thread_ctrl::state() != thread_state::aborting) while (!g_system_progress_stopping && thread_ctrl::state() != thread_state::aborting)
{ {
@ -208,9 +210,18 @@ void progress_dialog_server::operator()()
const u64 remaining_usec = pdone ? utils::rational_mul<u64>(passed_usec, static_cast<u64>(ptotal) - pdone, pdone) : (passed_usec * ptotal); const u64 remaining_usec = pdone ? utils::rational_mul<u64>(passed_usec, static_cast<u64>(ptotal) - pdone, pdone) : (passed_usec * ptotal);
// Only show compile notification if we estimate at least 100ms // Only show compile notification if we estimate at least 100ms
if (remaining_usec >= 100'000ULL) if (remaining_usec >= 100'000ULL && (!ppu_cue_refs || !*ppu_cue_refs))
{ {
rsx::overlays::show_ppu_compile_notification(); ppu_cue_refs = rsx::overlays::show_ppu_compile_notification();
}
}
if (pdone >= ptotal)
{
if (ppu_cue_refs)
{
*ppu_cue_refs = 0;
ppu_cue_refs.reset();
} }
} }
@ -321,6 +332,11 @@ void progress_dialog_server::operator()()
wait_no_update_count++; wait_no_update_count++;
} }
if (ppu_cue_refs)
{
*ppu_cue_refs = 0;
}
if (g_system_progress_stopping || thread_ctrl::state() == thread_state::aborting) if (g_system_progress_stopping || thread_ctrl::state() == thread_state::aborting)
{ {
break; break;