Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion librecomp/src/pi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void recomp::do_rom_read(uint8_t* rdram, gpr ram_address, uint32_t physical_addr
// TODO use word copies when possible

// TODO handle misaligned DMA
assert((physical_addr & 0x1) == 0 && "Only PI DMA from aligned ROM addresses is currently supported");
physical_addr &= ~1;
assert((ram_address & 0x7) == 0 && "Only PI DMA to aligned RDRAM addresses is currently supported");
uint8_t* rom_addr = rom.data() + physical_addr - recomp::rom_base;
for (size_t i = 0; i < num_bytes; i++) {
Expand Down
11 changes: 11 additions & 0 deletions ultramodern/include/ultramodern/renderer_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,23 @@ namespace ultramodern {
GraphicsDeviceNotFound
};

struct MipsInterrupts {
bool dp = false;
bool sp = false;
};

class RendererContext {
public:
virtual ~RendererContext() = default;

virtual bool valid() = 0;
virtual SetupResult get_setup_result() const { return setup_result; }
virtual GraphicsApi get_chosen_api() const { return chosen_api; }
virtual MipsInterrupts get_and_clear_mips_interrupts() {
MipsInterrupts result = mips_interrupts;
mips_interrupts = {};
return result;
}

virtual bool update_config(const GraphicsConfig& old_config, const GraphicsConfig& new_config) = 0;

Expand All @@ -93,6 +103,7 @@ namespace ultramodern {
protected:
SetupResult setup_result;
GraphicsApi chosen_api;
MipsInterrupts mips_interrupts;
};

struct callbacks_t {
Expand Down
5 changes: 3 additions & 2 deletions ultramodern/src/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ void gfx_thread_func(uint8_t* rdram, moodycamel::LightweightSemaphore* thread_re
// start another graphics task until the RDP is also complete. Games usually preserve the RSP inputs until the RDP
// is finished as well, so sending this early shouldn't be an issue in most cases.
// If this causes issues then the logic can be replaced with responding to yield requests.
sp_complete();
ultramodern::measure_input_latency();

PTR(u64) displaylist = task_action->task.t.data_ptr;
Expand All @@ -378,7 +377,9 @@ void gfx_thread_func(uint8_t* rdram, moodycamel::LightweightSemaphore* thread_re
renderer_context->send_dl(&task_action->task);
[[maybe_unused]] auto renderer_end = std::chrono::high_resolution_clock::now();

dp_complete();
ultramodern::renderer::MipsInterrupts interrupts = renderer_context->get_and_clear_mips_interrupts();
if (interrupts.sp) sp_complete();
if (interrupts.dp) dp_complete();
// TODO hook the parsed event up to the actual parsing point when a callback is added to RT64.
ultramodern::extensions::on_displaylist_parsed(displaylist);
ultramodern::extensions::on_displaylist_completed(displaylist);
Expand Down