mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
minor cleanup
This commit is contained in:
parent
52e097d97c
commit
7f73dc35f9
13
src/GPU3D.h
13
src/GPU3D.h
@ -342,7 +342,6 @@ public:
|
|||||||
static constexpr int ScanlineReadSpeed = 256 * TimingFrac;
|
static constexpr int ScanlineReadSpeed = 256 * TimingFrac;
|
||||||
static constexpr int ScanlineReadInc = DelayBetweenReads + ScanlineReadSpeed;
|
static constexpr int ScanlineReadInc = DelayBetweenReads + ScanlineReadSpeed;
|
||||||
|
|
||||||
|
|
||||||
//static constexpr int GPU2DSpeedFirstInPair = 810 * TimingFrac; // 810 | the delay between finishing reading a pair and beginning reading a new pair.
|
//static constexpr int GPU2DSpeedFirstInPair = 810 * TimingFrac; // 810 | the delay between finishing reading a pair and beginning reading a new pair.
|
||||||
//static constexpr int GPU2DSpeedSecondInPair = 296 * TimingFrac; // 296 | 295??? | the delay between finishing reading the first scanline
|
//static constexpr int GPU2DSpeedSecondInPair = 296 * TimingFrac; // 296 | 295??? | the delay between finishing reading the first scanline
|
||||||
// and beginning reading the second scanline of a scanline pair.
|
// and beginning reading the second scanline of a scanline pair.
|
||||||
@ -352,6 +351,18 @@ public:
|
|||||||
//static constexpr int GPU2D48Scanlines = GPU2DReadSLPair * 24; // time to read 48 scanlines.
|
//static constexpr int GPU2D48Scanlines = GPU2DReadSLPair * 24; // time to read 48 scanlines.
|
||||||
static constexpr int FrameLength = ScanlineReadInc * 263; // how long the entire frame is. TODO: Verify if we actually need this?
|
static constexpr int FrameLength = ScanlineReadInc * 263; // how long the entire frame is. TODO: Verify if we actually need this?
|
||||||
|
|
||||||
|
// compile-time list of scanline read times
|
||||||
|
// these *should* always occur at the same point in each frame, so it shouldn't matter if we make them fixed
|
||||||
|
constexpr std::array<u32, 192> SLRead = []() constexpr {
|
||||||
|
std::array<u32, 192> readtime {};
|
||||||
|
|
||||||
|
for (int i = 0, time = InitGPU2DTimeout; i < 192; i++, time += ScanlineReadInc)
|
||||||
|
{
|
||||||
|
readtime[i] = time;
|
||||||
|
}
|
||||||
|
return readtime;
|
||||||
|
}();
|
||||||
|
|
||||||
// GPU 3D Rasterization Timings: For Emulating Scanline Timeout
|
// GPU 3D Rasterization Timings: For Emulating Scanline Timeout
|
||||||
|
|
||||||
//static constexpr int ScanlinePairLength = 2130 * TimingFrac;
|
//static constexpr int ScanlinePairLength = 2130 * TimingFrac;
|
||||||
|
@ -1890,12 +1890,6 @@ void SoftRenderer::RenderPolygons(GPU& gpu, Polygon** polygons, int npolys)
|
|||||||
gpu.GPU3D.RDLinesUnderflow = false;
|
gpu.GPU3D.RDLinesUnderflow = false;
|
||||||
gpu.GPU3D.RDLinesTemp = 63;
|
gpu.GPU3D.RDLinesTemp = 63;
|
||||||
|
|
||||||
u32 slread[192]; // scanline read times
|
|
||||||
for (int i = 0, time = InitGPU2DTimeout; i < 192; i++, time += ScanlineReadInc) // CHECKME: is this computed at compile time?
|
|
||||||
{
|
|
||||||
slread[i] = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
ScanlineTimeout = FrameLength; // CHECKME
|
ScanlineTimeout = FrameLength; // CHECKME
|
||||||
|
|
||||||
s32 rastertimingeven; // always init to 0 at the start of a scanline render
|
s32 rastertimingeven; // always init to 0 at the start of a scanline render
|
||||||
@ -1918,10 +1912,10 @@ void SoftRenderer::RenderPolygons(GPU& gpu, Polygon** polygons, int npolys)
|
|||||||
|
|
||||||
// if first pair was not delayed past the first read, then later scanlines cannot either
|
// if first pair was not delayed past the first read, then later scanlines cannot either
|
||||||
// this allows us to implement a fast path
|
// this allows us to implement a fast path
|
||||||
//if (slread[0] - timespent + ScanlinePushDelay >= 256)
|
//if (SLRead[0] - timespent + ScanlinePushDelay >= 256)
|
||||||
{
|
{
|
||||||
// begin scanline timeout
|
// begin scanline timeout
|
||||||
ScanlineTimeout = slread[1] - FinalPassLen;
|
ScanlineTimeout = SLRead[1] - FinalPassLen;
|
||||||
|
|
||||||
RenderScanline(gpu, 2, j, &rastertimingeven);
|
RenderScanline(gpu, 2, j, &rastertimingeven);
|
||||||
RenderScanline(gpu, 3, j, &rastertimingodd);
|
RenderScanline(gpu, 3, j, &rastertimingodd);
|
||||||
@ -1937,11 +1931,11 @@ void SoftRenderer::RenderPolygons(GPU& gpu, Polygon** polygons, int npolys)
|
|||||||
scanlineswaiting++;
|
scanlineswaiting++;
|
||||||
|
|
||||||
// simulate the process of scanlines being read from the 48 scanline buffer
|
// simulate the process of scanlines being read from the 48 scanline buffer
|
||||||
while (RasterTiming >= slread[nextread] + 565)
|
while (RasterTiming >= SLRead[nextread] + 565)
|
||||||
{
|
{
|
||||||
if (RasterTiming < slread[nextread] + 565)
|
if (RasterTiming < SLRead[nextread] + 565)
|
||||||
{
|
{
|
||||||
RasterTiming += timespent = (slread[nextread] + 565) - RasterTiming; // why + 565?
|
RasterTiming += timespent = (SLRead[nextread] + 565) - RasterTiming; // why + 565?
|
||||||
timespent += 571; // fixes edge marking bug emulation. not sure why this is needed?
|
timespent += 571; // fixes edge marking bug emulation. not sure why this is needed?
|
||||||
}
|
}
|
||||||
scanlineswaiting--;
|
scanlineswaiting--;
|
||||||
@ -1955,7 +1949,7 @@ void SoftRenderer::RenderPolygons(GPU& gpu, Polygon** polygons, int npolys)
|
|||||||
for (int y = 4; y < 192; y+=2)
|
for (int y = 4; y < 192; y+=2)
|
||||||
{
|
{
|
||||||
//update sl timeout
|
//update sl timeout
|
||||||
ScanlineTimeout = slread[y-1] - FinalPassLen;
|
ScanlineTimeout = SLRead[y-1] - FinalPassLen;
|
||||||
|
|
||||||
RenderScanline(gpu, y, j, &rastertimingeven);
|
RenderScanline(gpu, y, j, &rastertimingeven);
|
||||||
RenderScanline(gpu, y+1, j, &rastertimingodd);
|
RenderScanline(gpu, y+1, j, &rastertimingodd);
|
||||||
@ -1970,11 +1964,11 @@ void SoftRenderer::RenderPolygons(GPU& gpu, Polygon** polygons, int npolys)
|
|||||||
scanlineswaiting+=2;
|
scanlineswaiting+=2;
|
||||||
|
|
||||||
// simulate the process of scanlines being read from the 48 scanline buffer
|
// simulate the process of scanlines being read from the 48 scanline buffer
|
||||||
while (scanlineswaiting >= 47 || RasterTiming >= slread[nextread] + 565)
|
while (scanlineswaiting >= 47 || RasterTiming >= SLRead[nextread] + 565)
|
||||||
{
|
{
|
||||||
if (RasterTiming < slread[nextread] + 565)
|
if (RasterTiming < SLRead[nextread] + 565)
|
||||||
{
|
{
|
||||||
RasterTiming += timespent = (slread[nextread] + 565) - RasterTiming; // why + 565?
|
RasterTiming += timespent = (SLRead[nextread] + 565) - RasterTiming; // why + 565?
|
||||||
timespent += 571; // fixes edge marking bug emulation. not sure why this is needed?
|
timespent += 571; // fixes edge marking bug emulation. not sure why this is needed?
|
||||||
}
|
}
|
||||||
scanlineswaiting--;
|
scanlineswaiting--;
|
||||||
@ -1991,11 +1985,11 @@ void SoftRenderer::RenderPolygons(GPU& gpu, Polygon** polygons, int npolys)
|
|||||||
|
|
||||||
// emulate read timings one last time, since it shouldn't matter after this
|
// emulate read timings one last time, since it shouldn't matter after this
|
||||||
// additionally dont bother tracking rdlines anymore since it shouldn't be able to decrement anymore (CHECKME)
|
// additionally dont bother tracking rdlines anymore since it shouldn't be able to decrement anymore (CHECKME)
|
||||||
while (scanlineswaiting >= 47 || RasterTiming >= slread[nextread] + 565)
|
while (scanlineswaiting >= 47 || RasterTiming >= SLRead[nextread] + 565)
|
||||||
{
|
{
|
||||||
if (RasterTiming < slread[nextread] + 565)
|
if (RasterTiming < SLRead[nextread] + 565)
|
||||||
{
|
{
|
||||||
RasterTiming += timespent = (slread[nextread] + 565) - RasterTiming; // why + 565?
|
RasterTiming += timespent = (SLRead[nextread] + 565) - RasterTiming; // why + 565?
|
||||||
timespent += 571; // fixes edge marking bug emulation. not sure why this is needed?
|
timespent += 571; // fixes edge marking bug emulation. not sure why this is needed?
|
||||||
}
|
}
|
||||||
scanlineswaiting--;
|
scanlineswaiting--;
|
||||||
@ -2012,9 +2006,9 @@ void SoftRenderer::RenderPolygons(GPU& gpu, Polygon** polygons, int npolys)
|
|||||||
{
|
{
|
||||||
ScanlineFinalPass(gpu, 0, false, false);
|
ScanlineFinalPass(gpu, 0, false, false);
|
||||||
|
|
||||||
s32 pixelstopush = slread[0] - (timespent + ScanlinePushDelay);
|
s32 pixelstopush = SLRead[0] - (timespent + ScanlinePushDelay);
|
||||||
if (pixelstopush > 256) pixelstopush = 256;
|
if (pixelstopush > 256) pixelstopush = 256;
|
||||||
//timespent + ScanlinePushDelay + ScanlineReadSpeed > slread[0]
|
//timespent + ScanlinePushDelay + ScanlineReadSpeed > SLRead[0]
|
||||||
|
|
||||||
rastertimingeven = 0;
|
rastertimingeven = 0;
|
||||||
rastertimingodd = 0;
|
rastertimingodd = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user