From 4a2806829574c6661c342e60e9430edb6d8b49dd Mon Sep 17 00:00:00 2001 From: RSDuck Date: Tue, 26 Jan 2021 19:05:21 +0100 Subject: [PATCH] the rasteriser doesn't have to be done on line 144 thanks to the VRAM cache --- src/GPU.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/GPU.cpp b/src/GPU.cpp index 40334de7..e31b2392 100644 --- a/src/GPU.cpp +++ b/src/GPU.cpp @@ -1124,6 +1124,14 @@ void StartScanline(u32 line) { if (VCount == 192) { + // in reality rendering already finishes at line 144 + // and games might already start to modify texture memory. + // That doesn't matter for us because we cache the entire + // texture memory anyway and only update it before the start + //of the next frame. + // So we can give the rasteriser a bit more headroom + GPU3D::VCount144(); + // VBlank DispStat[0] |= (1<<0); DispStat[1] |= (1<<0); @@ -1144,10 +1152,6 @@ void StartScanline(u32 line) if (Accelerated) GLCompositor::RenderFrame(); #endif } - else if (VCount == 144) - { - GPU3D::VCount144(); - } } NDS::ScheduleEvent(NDS::Event_LCD, true, HBLANK_CYCLES, StartHBlank, line);