1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

RSX: fix shader cache progress bar exit state shenanigans

This commit is contained in:
Megamouse 2018-06-09 17:42:50 +02:00 committed by kd-11
parent 2b8cab906c
commit a8f19fbfae
4 changed files with 27 additions and 13 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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<std::chrono::milliseconds>(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();
}