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 29, 2021
1 parent 3e48c97 commit b1b79a2
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 24 deletions.
1 change: 0 additions & 1 deletion rpcs3/Emu/Cell/PPUModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,6 @@ void try_spawn_ppu_if_exclusive_program(const ppu_module& m)

auto ppu = idm::make_ptr<named_thread<ppu_thread>>("PPU[0x1000000] Thread (test_thread)", p, "test_thread", 0);

ppu->cmd_push({ppu_cmd::initialize, 0});
ppu->cia = m.funcs[0].addr;

// For kernel explorer
Expand Down
10 changes: 9 additions & 1 deletion rpcs3/Emu/Cell/PPUThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,15 @@ void ppu_thread::cpu_task()
}
case ppu_cmd::initialize:
{
cmd_pop(), ppu_initialize(), spu_cache::initialize();
cmd_pop();

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
56 changes: 34 additions & 22 deletions rpcs3/Emu/RSX/RSXThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,27 +506,12 @@ namespace rsx

void thread::cpu_task()
{
while (Emu.IsReady())
{
// 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();
thread_ctrl::wait_for(1000);
}

on_task();
on_exit();
}

Expand All @@ -548,7 +533,7 @@ namespace rsx
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 +543,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 Expand Up @@ -644,9 +659,6 @@ namespace rsx
thread_ctrl::set_thread_affinity_mask(thread_ctrl::get_affinity_mask(thread_class::rsx));
}

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

while (!test_stopped())
{
// Wait for external pause events
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 @@ -649,6 +649,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 b1b79a2

Please sign in to comment.