mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
improve when 3d dispcnt underflow flag updates
This commit is contained in:
parent
520f7a0f3a
commit
1c24fe03c2
13
src/GPU.cpp
13
src/GPU.cpp
@ -1002,6 +1002,13 @@ void GPU::StartScanline(u32 line) noexcept
|
|||||||
NDS.ScheduleEvent(Event_DisplayFIFO, false, 32, 0, 0);
|
NDS.ScheduleEvent(Event_DisplayFIFO, false, 32, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (VCount == GPU3D.UnderflowFlagVCount)
|
||||||
|
{
|
||||||
|
// appears to get set the vcount before the underflow occured?
|
||||||
|
// probably gets updated the instant the underflow happened, which might be annoying to work out with precision.
|
||||||
|
GPU3D.DispCnt |= (1<<12);
|
||||||
|
}
|
||||||
|
|
||||||
if (VCount == 262)
|
if (VCount == 262)
|
||||||
{
|
{
|
||||||
// frame end
|
// frame end
|
||||||
@ -1017,7 +1024,7 @@ void GPU::StartScanline(u32 line) noexcept
|
|||||||
// and games might already start to modify texture memory.
|
// and games might already start to modify texture memory.
|
||||||
// That doesn't matter for us because we cache the entire
|
// That doesn't matter for us because we cache the entire
|
||||||
// texture memory anyway and only update it before the start
|
// texture memory anyway and only update it before the start
|
||||||
//of the next frame.
|
// of the next frame.
|
||||||
// So we can give the rasteriser a bit more headroom
|
// So we can give the rasteriser a bit more headroom
|
||||||
GPU3D.VCount144(*this);
|
GPU3D.VCount144(*this);
|
||||||
|
|
||||||
@ -1041,10 +1048,6 @@ void GPU::StartScanline(u32 line) noexcept
|
|||||||
if (GPU3D.IsRendererAccelerated())
|
if (GPU3D.IsRendererAccelerated())
|
||||||
GPU3D.Blit(*this);
|
GPU3D.Blit(*this);
|
||||||
}
|
}
|
||||||
else if (VCount == 183)
|
|
||||||
{
|
|
||||||
GPU3D.DispCnt |= GPU3D.RDLinesUnderflow << 12; // CHECKME: does this get set *exactly* at vcount 183? earlier? later?
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NDS.ScheduleEvent(Event_LCD, true, HBLANK_CYCLES, LCD_StartHBlank, line);
|
NDS.ScheduleEvent(Event_LCD, true, HBLANK_CYCLES, LCD_StartHBlank, line);
|
||||||
|
@ -255,7 +255,8 @@ void GPU3D::Reset() noexcept
|
|||||||
ClearAttr2 = 0x00007FFF;
|
ClearAttr2 = 0x00007FFF;
|
||||||
|
|
||||||
ResetRenderingState();
|
ResetRenderingState();
|
||||||
|
|
||||||
|
UnderflowFlagVCount = -1;
|
||||||
RDLines = 63;
|
RDLines = 63;
|
||||||
|
|
||||||
AbortFrame = false;
|
AbortFrame = false;
|
||||||
|
@ -251,7 +251,7 @@ public:
|
|||||||
|
|
||||||
u32 DispCnt = 0;
|
u32 DispCnt = 0;
|
||||||
|
|
||||||
bool RDLinesUnderflow = false;
|
u16 UnderflowFlagVCount = 0;
|
||||||
u8 RDLines = 0;
|
u8 RDLines = 0;
|
||||||
u8 RDLinesTemp = 0;
|
u8 RDLinesTemp = 0;
|
||||||
|
|
||||||
|
@ -228,16 +228,16 @@ void SoftRenderer::FindFirstPolyDoTimings(int npolys, s32 y, int* firstpolyeven,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*timingcountereven = fixeddelay*FirstPolyDelay;// + perslope*FirstPerSlope + etc*2;
|
*timingcountereven = fixeddelay*FirstPolyDelay;// + perslope*FirstPerSlope + etc*2;
|
||||||
*timingcounterodd = fixeddelay*FirstPolyDelay;/// + perslope*FirstPerSlope + etc*2;
|
*timingcounterodd = fixeddelay*FirstPolyDelay;// + perslope*FirstPerSlope + etc*2;
|
||||||
if (!perslope)
|
if (!perslope)
|
||||||
{
|
{
|
||||||
*timingcountereven += etc*2;// + perslope*FirstPerSlope + etc*2;
|
*timingcountereven += etc*2;// + perslope*FirstPerSlope + etc*2;
|
||||||
*timingcounterodd += etc*2;/// + perslope*FirstPerSlope + etc*2;
|
*timingcounterodd += etc*2;// + perslope*FirstPerSlope + etc*2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*timingcountereven += perslope*FirstPerSlope;// + perslope*FirstPerSlope + etc*2;
|
*timingcountereven += perslope*FirstPerSlope;// + perslope*FirstPerSlope + etc*2;
|
||||||
*timingcounterodd += perslope*FirstPerSlope;/// + perslope*FirstPerSlope + etc*2;
|
*timingcounterodd += perslope*FirstPerSlope;// + perslope*FirstPerSlope + etc*2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1959,7 +1959,7 @@ void SoftRenderer::FinishPushScanline(s32 y, s32 pixelsremain)
|
|||||||
RasterTiming += std::clamp(ScanlineTimeout - RasterTiming, 0, 12);\
|
RasterTiming += std::clamp(ScanlineTimeout - RasterTiming, 0, 12);\
|
||||||
\
|
\
|
||||||
/* set the underflow flag if one of the scanlines came within 14 cycles of visible underflow */\
|
/* set the underflow flag if one of the scanlines came within 14 cycles of visible underflow */\
|
||||||
if (ScanlineTimeout <= RasterTiming) gpu.GPU3D.RDLinesUnderflow = true;
|
if ((ScanlineTimeout <= RasterTiming) && (gpu.GPU3D.UnderflowFlagVCount == (u16)-1)) gpu.GPU3D.UnderflowFlagVCount = y-1;
|
||||||
|
|
||||||
void SoftRenderer::RenderPolygonsFast(GPU& gpu, Polygon** polygons, int npolys)
|
void SoftRenderer::RenderPolygonsFast(GPU& gpu, Polygon** polygons, int npolys)
|
||||||
{
|
{
|
||||||
@ -1992,7 +1992,7 @@ void SoftRenderer::RenderPolygonsTiming(GPU& gpu, Polygon** polygons, int npolys
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reset scanline trackers
|
// reset scanline trackers
|
||||||
gpu.GPU3D.RDLinesUnderflow = false;
|
gpu.GPU3D.UnderflowFlagVCount = -1;
|
||||||
gpu.GPU3D.RDLinesTemp = 63;
|
gpu.GPU3D.RDLinesTemp = 63;
|
||||||
ScanlineTimeout = FrameLength; // CHECKME
|
ScanlineTimeout = FrameLength; // CHECKME
|
||||||
s32 rastertimingeven, rastertimingodd; // always init to 0 at the start of a scanline render
|
s32 rastertimingeven, rastertimingodd; // always init to 0 at the start of a scanline render
|
||||||
|
Loading…
Reference in New Issue
Block a user