mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-15 13:21:14 +00:00
Emu/overlay: ingame native overlay PPU compilation
This commit is contained in:
parent
e557c962fb
commit
870224cde0
@ -80,6 +80,7 @@ const bool s_use_ssse3 = utils::has_ssse3();
|
||||
extern atomic_t<u64> g_watchdog_hold_ctr;
|
||||
|
||||
extern atomic_t<const char*> g_progr;
|
||||
extern atomic_t<bool> g_progr_show;
|
||||
extern atomic_t<u32> g_progr_ftotal;
|
||||
extern atomic_t<u32> g_progr_fdone;
|
||||
extern atomic_t<u32> g_progr_ptotal;
|
||||
@ -2400,9 +2401,9 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<lv2_
|
||||
}
|
||||
}
|
||||
|
||||
g_progr = "Compiling PPU modules";
|
||||
|
||||
g_progr = "Compiling PPU modules...";
|
||||
g_progr_ftotal += file_queue.size();
|
||||
g_progr_show = true;
|
||||
|
||||
atomic_t<usz> fnext = 0;
|
||||
|
||||
@ -2519,6 +2520,8 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<lv2_
|
||||
// Join every thread
|
||||
workers.join();
|
||||
|
||||
g_progr_show = false;
|
||||
|
||||
// Revert changes
|
||||
|
||||
if (!had_ovl)
|
||||
@ -2543,6 +2546,17 @@ extern void ppu_initialize()
|
||||
return;
|
||||
}
|
||||
|
||||
g_progr = "Scanning PPU modules...";
|
||||
g_progr_show = true;
|
||||
|
||||
struct scoped_dialog_control
|
||||
{
|
||||
~scoped_dialog_control()
|
||||
{
|
||||
g_progr_show = false;
|
||||
}
|
||||
} dialog_control;
|
||||
|
||||
bool compile_main = false;
|
||||
|
||||
// Check main module cache
|
||||
@ -2715,8 +2729,12 @@ bool ppu_initialize(const ppu_module& info, bool check_only)
|
||||
}
|
||||
|
||||
#ifdef LLVM_AVAILABLE
|
||||
// Initialize progress dialog
|
||||
g_progr = "Compiling PPU modules...";
|
||||
if (!check_only)
|
||||
{
|
||||
// Initialize progress dialog
|
||||
g_progr = "Loading PPU modules...";
|
||||
g_progr_show = true;
|
||||
}
|
||||
|
||||
struct jit_core_allocator
|
||||
{
|
||||
@ -2945,6 +2963,9 @@ bool ppu_initialize(const ppu_module& info, bool check_only)
|
||||
|
||||
if (!check_only)
|
||||
{
|
||||
// Update progress dialog
|
||||
g_progr_ptotal++;
|
||||
|
||||
link_workload.emplace_back(obj_name, false);
|
||||
}
|
||||
|
||||
@ -2972,9 +2993,6 @@ bool ppu_initialize(const ppu_module& info, bool check_only)
|
||||
|
||||
// Fill workload list for compilation
|
||||
workload.emplace_back(std::move(obj_name), std::move(part));
|
||||
|
||||
// Update progress dialog
|
||||
g_progr_ptotal++;
|
||||
}
|
||||
|
||||
if (check_only)
|
||||
@ -2982,6 +3000,11 @@ bool ppu_initialize(const ppu_module& info, bool check_only)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!workload.empty())
|
||||
{
|
||||
g_progr = "Compiling PPU modules...";
|
||||
}
|
||||
|
||||
// Create worker threads for compilation (TODO: how many threads)
|
||||
{
|
||||
u32 thread_count = Emu.GetMaxThreads();
|
||||
@ -3033,9 +3056,16 @@ bool ppu_initialize(const ppu_module& info, bool check_only)
|
||||
|
||||
if (Emu.IsStopped() || !get_current_cpu_thread())
|
||||
{
|
||||
g_progr_show = false;
|
||||
return compiled_new;
|
||||
}
|
||||
|
||||
if (workload.size() < link_workload.size())
|
||||
{
|
||||
// Only show this message if this task is relevant
|
||||
g_progr = "Linking PPU modules...";
|
||||
}
|
||||
|
||||
for (auto [obj_name, is_compiled] : link_workload)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
@ -3048,10 +3078,13 @@ bool ppu_initialize(const ppu_module& info, bool check_only)
|
||||
if (!is_compiled)
|
||||
{
|
||||
ppu_log.success("LLVM: Loaded module %s", obj_name);
|
||||
g_progr_pdone++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_progr_show = false;
|
||||
|
||||
if (Emu.IsStopped() || !get_current_cpu_thread())
|
||||
{
|
||||
return compiled_new;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "util/sysinfo.hpp"
|
||||
|
||||
extern atomic_t<const char*> g_progr;
|
||||
extern atomic_t<bool> g_progr_show;
|
||||
extern atomic_t<u32> g_progr_ptotal;
|
||||
extern atomic_t<u32> g_progr_pdone;
|
||||
|
||||
@ -426,6 +427,7 @@ void spu_cache::initialize()
|
||||
|
||||
g_progr = "Building SPU cache...";
|
||||
g_progr_ptotal += ::size32(func_list);
|
||||
g_progr_show = true;
|
||||
|
||||
worker_count = Emu.GetMaxThreads();
|
||||
}
|
||||
@ -525,6 +527,11 @@ void spu_cache::initialize()
|
||||
spu_log.notice("SPU Runtime: Worker %u built %u programs.", i + 1, workers[i]);
|
||||
}
|
||||
|
||||
if (g_cfg.core.spu_decoder == spu_decoder_type::asmjit || g_cfg.core.spu_decoder == spu_decoder_type::llvm)
|
||||
{
|
||||
g_progr_show = false;
|
||||
}
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
spu_log.error("SPU Runtime: Cache building aborted.");
|
||||
|
@ -209,11 +209,7 @@ namespace rsx
|
||||
btn_cancel.translate(0, offset);
|
||||
}
|
||||
|
||||
text_display.set_text(text);
|
||||
|
||||
u16 text_w, text_h;
|
||||
text_display.measure_text(text_w, text_h);
|
||||
text_display.translate(0, -(text_h - 16));
|
||||
set_text(text);
|
||||
|
||||
switch (type.button_type.unshifted())
|
||||
{
|
||||
@ -306,6 +302,15 @@ namespace rsx
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
void message_dialog::set_text(const std::string& text)
|
||||
{
|
||||
u16 text_w, text_h;
|
||||
text_display.set_pos(90, 364);
|
||||
text_display.set_text(text);
|
||||
text_display.measure_text(text_w, text_h);
|
||||
text_display.translate(0, -(text_h - 16));
|
||||
}
|
||||
|
||||
u32 message_dialog::progress_bar_count()
|
||||
{
|
||||
return num_progress_bars;
|
||||
|
@ -35,6 +35,8 @@ namespace rsx
|
||||
|
||||
error_code show(bool is_blocking, const std::string& text, const MsgDialogType& type, std::function<void(s32 status)> on_close);
|
||||
|
||||
void set_text(const std::string& text);
|
||||
|
||||
u32 progress_bar_count();
|
||||
void progress_bar_set_taskbar_index(s32 index);
|
||||
error_code progress_bar_set_message(u32 index, const std::string& msg);
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "Emu/title.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/RSX/Capture/rsx_replay.h"
|
||||
#include "Emu/RSX/Overlays/overlay_message_dialog.h"
|
||||
|
||||
#include "Loader/PSF.h"
|
||||
#include "Loader/ELF.h"
|
||||
@ -82,6 +83,7 @@ std::mutex g_tty_mutex;
|
||||
|
||||
// Progress display server synchronization variables
|
||||
atomic_t<const char*> g_progr{""};
|
||||
atomic_t<bool> g_progr_show{false};
|
||||
atomic_t<u32> g_progr_ftotal{0};
|
||||
atomic_t<u32> g_progr_fdone{0};
|
||||
atomic_t<u32> g_progr_ptotal{0};
|
||||
@ -341,7 +343,7 @@ namespace
|
||||
while (thread_ctrl::state() != thread_state::aborting)
|
||||
{
|
||||
// Wait for the start condition
|
||||
while (!g_progr_ftotal && !g_progr_ptotal)
|
||||
while (!g_progr_show)
|
||||
{
|
||||
if (thread_ctrl::state() == thread_state::aborting)
|
||||
{
|
||||
@ -357,9 +359,29 @@ namespace
|
||||
}
|
||||
|
||||
// Initialize message dialog
|
||||
std::shared_ptr<MsgDialogBase> dlg = Emu.GetCallbacks().get_msg_dialog();
|
||||
if (dlg)
|
||||
std::shared_ptr<MsgDialogBase> dlg;
|
||||
std::shared_ptr<rsx::overlays::message_dialog> native_dlg;
|
||||
|
||||
if (const auto renderer = rsx::get_current_renderer();
|
||||
renderer && renderer->is_inited)
|
||||
{
|
||||
if (auto manager = g_fxo->try_get<rsx::overlays::display_manager>())
|
||||
{
|
||||
MsgDialogType type{};
|
||||
type.se_normal = true;
|
||||
type.bg_invisible = true;
|
||||
type.disable_cancel = true;
|
||||
type.progress_bar_count = 1;
|
||||
|
||||
native_dlg = manager->create<rsx::overlays::message_dialog>(!!g_cfg.video.shader_preloading_dialog.use_custom_background);
|
||||
native_dlg->show(false, +g_progr, type, nullptr);
|
||||
native_dlg->progress_bar_set_message(0, "Please wait");
|
||||
}
|
||||
}
|
||||
|
||||
if (!native_dlg)
|
||||
{
|
||||
dlg = Emu.GetCallbacks().get_msg_dialog();
|
||||
dlg->type.se_normal = true;
|
||||
dlg->type.bg_invisible = true;
|
||||
dlg->type.progress_bar_count = 1;
|
||||
@ -414,7 +436,13 @@ namespace
|
||||
if (ptotal)
|
||||
fmt::append(progr, " module %u of %u", pdone, ptotal);
|
||||
|
||||
if (dlg)
|
||||
if (native_dlg)
|
||||
{
|
||||
native_dlg->set_text(+g_progr);
|
||||
native_dlg->progress_bar_set_message(0, progr);
|
||||
native_dlg->progress_bar_set_value(0, std::floor(value));
|
||||
}
|
||||
else if (dlg)
|
||||
{
|
||||
dlg->SetMsg(+g_progr);
|
||||
dlg->ProgressBarSetMsg(0, progr);
|
||||
@ -423,7 +451,7 @@ namespace
|
||||
});
|
||||
}
|
||||
|
||||
if (fdone >= ftotal && pdone >= ptotal)
|
||||
if (!g_progr_show)
|
||||
{
|
||||
// Close dialog
|
||||
break;
|
||||
@ -442,14 +470,19 @@ namespace
|
||||
g_progr_fdone -= fdone;
|
||||
g_progr_ptotal -= ptotal;
|
||||
g_progr_pdone -= pdone;
|
||||
g_progr_show = false;
|
||||
|
||||
if (dlg)
|
||||
Emu.CallAfter([=]()
|
||||
{
|
||||
Emu.CallAfter([=]()
|
||||
if (native_dlg)
|
||||
{
|
||||
native_dlg->close(false, false);
|
||||
}
|
||||
else if (dlg)
|
||||
{
|
||||
dlg->Close(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -459,6 +492,7 @@ namespace
|
||||
g_progr_fdone.release(0);
|
||||
g_progr_ptotal.release(0);
|
||||
g_progr_pdone.release(0);
|
||||
g_progr_show.release(false);
|
||||
}
|
||||
|
||||
static auto constexpr thread_name = "Progress Dialog Server"sv;
|
||||
|
Loading…
x
Reference in New Issue
Block a user