Skip to content

Commit

Permalink
rsx: Compile shaders when CELL is not running
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Mar 21, 2021
1 parent 2c05e97 commit 3a7070d
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 23 deletions.
15 changes: 14 additions & 1 deletion rpcs3/Emu/Cell/PPUThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,20 @@ void ppu_thread::cpu_task()
}
case ppu_cmd::initialize:
{
cmd_pop(), ppu_initialize(), spu_cache::initialize();
cmd_pop();

while (!g_fxo->is_init<rsx::thread>() && !is_stopped())
{
thread_ctrl::wait_for(1000);
}

while (!g_fxo->get<rsx::thread>().is_inited && !is_stopped())
{
// Wait for RSX to be initialized
thread_ctrl::wait_on(g_fxo->get<rsx::thread>().is_inited, false);
}

ppu_initialize(), spu_cache::initialize();
break;
}
case ppu_cmd::sleep:
Expand Down
57 changes: 35 additions & 22 deletions rpcs3/Emu/RSX/RSXThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,27 +506,7 @@ namespace rsx

void thread::cpu_task()
{
{
// Wait for startup (TODO)
while (m_rsx_thread_exiting)
{
// Wait for external pause events
if (external_interrupt_lock)
{
wait_pause();
}

thread_ctrl::wait_for(1000);

if (is_stopped())
{
return;
}
}

on_task();
}

on_task();
on_exit();
}

Expand All @@ -545,10 +525,13 @@ namespace rsx
{
m_rsx_thread = std::this_thread::get_id();

// Round to nearest to deal with forward/reverse scaling
fesetround(FE_TONEAREST);

g_tls_log_prefix = []
{
const auto rsx = get_current_renderer();
return fmt::format("RSX [0x%07x]", +rsx->ctrl->get);
return fmt::format("RSX [0x%07x]", rsx->ctrl ? +rsx->ctrl->get : 0);
};

method_registers.init();
Expand All @@ -558,12 +541,42 @@ namespace rsx
g_fxo->get<rsx::dma_manager>().init();
on_init_thread();

is_inited = true;
is_inited.notify_all();

if (!zcull_ctrl)
{
//Backend did not provide an implementation, provide NULL object
zcull_ctrl = std::make_unique<::rsx::reports::ZCULL_control>();
}

performance_counters.state = FIFO_state::empty;

// Wait for startup (TODO)
while (m_rsx_thread_exiting)
{
// Wait for external pause events
if (external_interrupt_lock)
{
wait_pause();
}

// Execute backend-local tasks first
do_local_task(performance_counters.state);

// Update sub-units
zcull_ctrl->update(this);

if (is_stopped())
{
return;
}

thread_ctrl::wait_for(1000);
}

performance_counters.state = FIFO_state::running;

fifo_ctrl = std::make_unique<::rsx::FIFO::FIFO_control>(this);

last_flip_time = get_system_time() - 1000000;
Expand Down
1 change: 1 addition & 0 deletions rpcs3/Emu/RSX/RSXThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ namespace rsx
u32 dbg_step_pc = 0;
atomic_t<u32> external_interrupt_lock{ 0 };
atomic_t<bool> external_interrupt_ack{ false };
atomic_t<bool> is_inited{ false };
bool is_fifo_idle() const;
void flush_fifo();
void recover_fifo();
Expand Down

0 comments on commit 3a7070d

Please sign in to comment.