mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
better implement when the line count reg is/isnt updated
This commit is contained in:
parent
e1cbadbe60
commit
75956b43c4
@ -241,9 +241,6 @@ void GPU3D::Reset() noexcept
|
||||
AlphaRefVal = 0;
|
||||
AlphaRef = 0;
|
||||
|
||||
RDLines = 63; // defaults to 63 for one frame? (CHECKME: when does it reset?)
|
||||
RDLinesTemp = 63;
|
||||
|
||||
memset(ToonTable, 0, sizeof(ToonTable));
|
||||
memset(EdgeTable, 0, sizeof(EdgeTable));
|
||||
|
||||
@ -257,6 +254,8 @@ void GPU3D::Reset() noexcept
|
||||
|
||||
ResetRenderingState();
|
||||
|
||||
RDLines = 63;
|
||||
|
||||
AbortFrame = false;
|
||||
|
||||
Timestamp = 0;
|
||||
@ -570,6 +569,7 @@ void GPU3D::SetEnabled(bool geometry, bool rendering) noexcept
|
||||
RenderingEnabled = rendering;
|
||||
|
||||
if (!rendering) ResetRenderingState();
|
||||
else RDLinesTemp = 63; // resets to 63 when the rasterizer is toggled on
|
||||
}
|
||||
|
||||
|
||||
@ -2431,11 +2431,14 @@ bool YSort(Polygon* a, Polygon* b)
|
||||
|
||||
void GPU3D::VBlank() noexcept
|
||||
{
|
||||
if (RenderingEnabled)
|
||||
RDLines = RDLinesTemp;
|
||||
|
||||
if (GeometryEnabled)
|
||||
{
|
||||
if (RenderingEnabled)
|
||||
{
|
||||
RDLines = RDLinesTemp;
|
||||
if (FlushRequest)
|
||||
{
|
||||
if (NumPolygons)
|
||||
|
@ -246,9 +246,11 @@ public:
|
||||
bool RenderingEnabled = false;
|
||||
|
||||
u32 DispCnt = 0;
|
||||
|
||||
bool RDLinesUnderflow = false;
|
||||
u8 RDLines = 63;
|
||||
u8 RDLinesTemp = 46;
|
||||
u8 RDLines = 0;
|
||||
u8 RDLinesTemp = 0;
|
||||
|
||||
u8 AlphaRefVal = 0;
|
||||
u8 AlphaRef = 0;
|
||||
|
||||
|
@ -1923,9 +1923,6 @@ void SoftRenderer::RenderPolygons(GPU& gpu, Polygon** polygons, int npolys)
|
||||
SetupPolygon(&PolygonList[j++], polygons[i]);
|
||||
}
|
||||
|
||||
//init internal buffer
|
||||
ClearBuffers(gpu);
|
||||
|
||||
// reset scanline trackers
|
||||
gpu.GPU3D.RDLinesUnderflow = false;
|
||||
gpu.GPU3D.RDLinesTemp = 63;
|
||||
@ -2022,7 +2019,16 @@ void SoftRenderer::RenderFrame(GPU& gpu)
|
||||
// "Render thread, you're up! Get moving."
|
||||
Platform::Semaphore_Post(Sema_RenderStart);
|
||||
}
|
||||
else if (!FrameIdentical) RenderPolygons(gpu, &gpu.GPU3D.RenderPolygonRAM[0], gpu.GPU3D.RenderNumPolygons);
|
||||
else if (!FrameIdentical)
|
||||
{
|
||||
//init internal buffer
|
||||
ClearBuffers(gpu);
|
||||
|
||||
if (gpu.GPU3D.RenderNumPolygons > 0)
|
||||
RenderPolygons(gpu, &gpu.GPU3D.RenderPolygonRAM[0], gpu.GPU3D.RenderNumPolygons);
|
||||
else
|
||||
memcpy(FinalBuffer, ColorBuffer, sizeof(FinalBuffer));
|
||||
}
|
||||
}
|
||||
|
||||
void SoftRenderer::RestartFrame(GPU& gpu)
|
||||
@ -2050,7 +2056,16 @@ void SoftRenderer::RenderThreadFunc(GPU& gpu)
|
||||
{ // If no rendering is needed, just say we're done.
|
||||
Platform::Semaphore_Post(Sema_ScanlineCount, 192);
|
||||
}
|
||||
else RenderPolygons(gpu, &gpu.GPU3D.RenderPolygonRAM[0], gpu.GPU3D.RenderNumPolygons);
|
||||
else
|
||||
{
|
||||
//init internal buffer
|
||||
ClearBuffers(gpu);
|
||||
|
||||
if (gpu.GPU3D.RenderNumPolygons > 0)
|
||||
RenderPolygons(gpu, &gpu.GPU3D.RenderPolygonRAM[0], gpu.GPU3D.RenderNumPolygons);
|
||||
else
|
||||
memcpy(FinalBuffer, ColorBuffer, sizeof(FinalBuffer));
|
||||
}
|
||||
|
||||
// Tell the main thread that we're done rendering
|
||||
// and that it's safe to access the GPU state again.
|
||||
|
Loading…
Reference in New Issue
Block a user