refactor framebuffers to be more similar to hw

allows for emulation of niche scanline glitches
This commit is contained in:
Jaklyy
2023-12-10 12:18:46 -05:00
parent c45d3320d0
commit 63a39b130e
4 changed files with 158 additions and 139 deletions

View File

@ -224,9 +224,6 @@ void GPU3D::Reset() noexcept
RDLines = 46;
RDLinesMin = 46;
RasterTimingCounterPrev = 0;
RasterTimingCounterOdd = 0;
RasterTimingCounterEven = 0;
memset(ToonTable, 0, sizeof(ToonTable));
memset(EdgeTable, 0, sizeof(EdgeTable));
@ -776,41 +773,6 @@ void GPU3D::StallPolygonPipeline(s32 delay, s32 nonstalldelay) noexcept
}
}
bool GPU3D::DoTimings(s32 cycles, bool odd)
{
if (odd)
{
RasterTimingCounterOdd += cycles;
if ((RasterTimingCounterOdd + RasterTimingCounterPrev) < RasterTimingCap) return false;
}
else
{
RasterTimingCounterEven += cycles;
if ((RasterTimingCounterEven + RasterTimingCounterPrev) < RasterTimingCap) return false;
}
DispCnt |= (1<<12);
return true;
}
void GPU3D::EndScanline(bool odd)
{
if (!odd)
{
RasterTimingCounterPrev += std::max(RasterTimingCounterOdd, RasterTimingCounterEven);
RasterTimingCounterPrev -= PerScanlineRecup; // wip
if (RasterTimingCounterPrev < 0) RasterTimingCounterPrev = 0;
// calc is wrong, seems to round up...?
RDLines = (RasterTimingCap - RasterTimingCounterPrev) / PerScanlineTiming;
// seems to display the lowest scanline buffer count reached during the current frame.
// we also caps it to 46 here, because this reg does that too for some reason.
if (RDLines > RDLinesMin) RDLines = RDLinesMin;
else if (RDLines < RDLinesMin) RDLinesMin = RDLines;
RasterTimingCounterOdd = 0;
RasterTimingCounterEven = 0;
}
}
template<int comp, s32 plane, bool attribs>
void ClipSegment(Vertex* outbuf, Vertex* vin, Vertex* vout)
{
@ -2409,9 +2371,6 @@ void GPU3D::CheckFIFODMA() noexcept
void GPU3D::VCount144() noexcept
{
RDLinesMin = 46;
RasterTimingCounterPrev = 0;
RasterTimingCounterOdd = 0;
RasterTimingCounterEven = 0;
CurrentRenderer->VCount144();
}