small fix

This commit is contained in:
Jaklyy 2024-04-21 14:48:46 -04:00
parent 424c5755ea
commit 1aa86967b5
2 changed files with 8 additions and 5 deletions

View File

@ -880,9 +880,9 @@ void GPU::StartHBlank(u32 line) noexcept
DispStat[0] |= (1<<1);
DispStat[1] |= (1<<1);
// not the correct timing, but... close enough i guess?
// TODO: not quite the correct update time, but... close enough i guess?
int scanline = (VCount == 262 ? 0 : (line+1));
GPU3D.ScanlineSync(scanline);
if (!(scanline & 1)) GPU3D.ScanlineSync(scanline);
if (GPU3D.UnderflowFlagVCount == scanline) GPU3D.DispCnt |= (1<<12);
if (VCount < 192)

View File

@ -2158,18 +2158,21 @@ void SoftRenderer::RenderThreadFunc(GPU& gpu)
}
void SoftRenderer::ScanlineSync(int line)
{
// only used in accurate mode (timings must be emulated)
if (Accuracy && RenderThreadRunning.load(std::memory_order_relaxed))
{
if (line < 192)
// We need a scanline, so let's wait for the render thread to finish it.
// (both threads process scanlines from top-to-bottom,
// so we don't need to wait for a specific row)
{
// wait for two scanlines here, since scanlines render in pairs.
Platform::Semaphore_Wait(Sema_ScanlineCount);
Platform::Semaphore_Wait(Sema_ScanlineCount);
}
}
}
u32* SoftRenderer::GetLine(int line)
{
// only wait in in-accurate mode (we've already waited for scanlines in accurate mode)
if (!Accuracy && RenderThreadRunning.load(std::memory_order_relaxed))
{
if (line < 192)