mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
cleanup more misc stuff
This commit is contained in:
parent
896df08c5c
commit
57e590269f
10
src/GPU3D.h
10
src/GPU3D.h
@ -348,7 +348,7 @@ public:
|
||||
static constexpr int DelayBetweenReads = 809 * TimingFrac;
|
||||
static constexpr int ScanlineReadSpeed = 256 * TimingFrac;
|
||||
static constexpr int ScanlineReadInc = DelayBetweenReads + ScanlineReadSpeed;
|
||||
static constexpr int InitGPU2DTimeout = 51875 * TimingFrac; // 51618? 51874? 52128? | when it finishes reading the first scanline.
|
||||
static constexpr int InitGPU2DTimeout = (51875+565) * TimingFrac; // 51618? 51874? 52128? | when it finishes reading the first scanline.
|
||||
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
|
||||
@ -363,8 +363,7 @@ public:
|
||||
return readtime;
|
||||
}();
|
||||
|
||||
static constexpr int Arbitrary = 565; // extra value after the scanline is read at which the cutoff of a scanline should be...?
|
||||
// idk why this is needed. im probably doing something wrong.
|
||||
static constexpr int PreReadCutoff = 565; // time before a read that a scanline is cutoff.
|
||||
|
||||
// the point at which rdlines decrements. not sure why it's different...?
|
||||
static constexpr std::array<u32, 192> RDDecrement = []() constexpr {
|
||||
@ -372,7 +371,7 @@ public:
|
||||
|
||||
for (int i = 0; i < 192; i++)
|
||||
{
|
||||
dec[i] = SLRead[i] + Arbitrary - 39 - (!(i % 2));
|
||||
dec[i] = SLRead[i] - 39 - (!(i % 2));
|
||||
}
|
||||
return dec;
|
||||
}();
|
||||
@ -400,9 +399,6 @@ public:
|
||||
// GPU 3D Rasterization Timings III, For First Polygon "Pre-Calc" Timings
|
||||
// should be added before other timings, as these are "async" pre-calcs of polygon attributes
|
||||
|
||||
static constexpr int FirstPerSlope = 1 * TimingFrac; // 1 | for each "slope" the first polygon has in this scanline increment it by 1.
|
||||
// (see DoTimingsSlopes() in GPU3D_Soft.cpp for more info)
|
||||
static constexpr int FirstNull = 1 * TimingFrac; // 1 | if the first polygon is "null" (probably wrong?)
|
||||
static constexpr int FirstPolyDelay = 4 * TimingFrac; // 4 | Min amount of cycles to begin a scanline? (minimum time it takes to init the first polygon?)
|
||||
// (Amount of time before the end of the cycle a scanline must abort?)
|
||||
|
||||
|
@ -193,15 +193,15 @@ void SoftRenderer::FindFirstPolyDoTimings(int npolys, s32 y, int* firstpolyeven,
|
||||
{
|
||||
fixeddelay = true;
|
||||
break;
|
||||
if (y == polygon->YBottom) break;
|
||||
/*if (y == polygon->YBottom) break;
|
||||
if (y == polygon->YTop) {perslope = true; break;}
|
||||
/*else if ((y == polygon->Vertices[rp->NextVL]->FinalPosition[1] || y == polygon->Vertices[rp->CurVL]->FinalPosition[1]) ||
|
||||
else if ((y == polygon->Vertices[rp->NextVL]->FinalPosition[1] || y == polygon->Vertices[rp->CurVL]->FinalPosition[1]) ||
|
||||
(y == polygon->Vertices[rp->NextVR]->FinalPosition[1] || y == polygon->Vertices[rp->CurVR]->FinalPosition[1]))
|
||||
{
|
||||
perslope = true;
|
||||
}
|
||||
else */etc = true;
|
||||
break;
|
||||
else etc = true;
|
||||
break;*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,21 +215,21 @@ void SoftRenderer::FindFirstPolyDoTimings(int npolys, s32 y, int* firstpolyeven,
|
||||
{
|
||||
fixeddelay = true;
|
||||
break;
|
||||
if (y == polygon->YBottom) break;
|
||||
/*if (y == polygon->YBottom) break;
|
||||
if (y == polygon->YTop) {perslope = true; break;}
|
||||
/*else if ((y == polygon->Vertices[rp->NextVL]->FinalPosition[1] || y == polygon->Vertices[rp->CurVL]->FinalPosition[1]) ||
|
||||
else if ((y == polygon->Vertices[rp->NextVL]->FinalPosition[1] || y == polygon->Vertices[rp->CurVL]->FinalPosition[1]) ||
|
||||
(y == polygon->Vertices[rp->NextVR]->FinalPosition[1] || y == polygon->Vertices[rp->CurVR]->FinalPosition[1]))
|
||||
{
|
||||
perslope = true;
|
||||
}
|
||||
else */etc = true;
|
||||
break;
|
||||
else etc = true;
|
||||
break;*/
|
||||
}
|
||||
}
|
||||
|
||||
*timingcountereven = fixeddelay*FirstPolyDelay;// + perslope*FirstPerSlope + etc*2;
|
||||
*timingcounterodd = fixeddelay*FirstPolyDelay;// + perslope*FirstPerSlope + etc*2;
|
||||
if (!perslope)
|
||||
*timingcountereven = fixeddelay ? FirstPolyDelay : 0;// + perslope*FirstPerSlope + etc*2;
|
||||
*timingcounterodd = fixeddelay ? FirstPolyDelay : 0;// + perslope*FirstPerSlope + etc*2;
|
||||
/*if (!perslope)
|
||||
{
|
||||
*timingcountereven += etc*2;// + perslope*FirstPerSlope + etc*2;
|
||||
*timingcounterodd += etc*2;// + perslope*FirstPerSlope + etc*2;
|
||||
@ -238,7 +238,7 @@ void SoftRenderer::FindFirstPolyDoTimings(int npolys, s32 y, int* firstpolyeven,
|
||||
{
|
||||
*timingcountereven += perslope*FirstPerSlope;// + perslope*FirstPerSlope + etc*2;
|
||||
*timingcounterodd += perslope*FirstPerSlope;// + perslope*FirstPerSlope + etc*2;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void SoftRenderer::TextureLookup(const GPU& gpu, u32 texparam, u32 texpal, s16 s, s16 t, u16* color, u8* alpha) const
|
||||
@ -1912,13 +1912,13 @@ void SoftRenderer::RenderPolygonsFast(GPU& gpu, Polygon** polygons, int npolys)
|
||||
|
||||
#define SCANLINE_BUFFER_SIM\
|
||||
/* simulate the process of scanlines being read from the 48 scanline buffer */\
|
||||
while (scanlineswaiting >= 47 || RasterTiming >= SLRead[nextread] + Arbitrary)\
|
||||
while (scanlineswaiting >= 47 || RasterTiming >= SLRead[nextread])\
|
||||
{\
|
||||
if (RasterTiming < SLRead[nextread] + Arbitrary) /* why + 565? */\
|
||||
if (RasterTiming < SLRead[nextread])\
|
||||
{\
|
||||
timespent = (SLRead[nextread] + Arbitrary) - RasterTiming;\
|
||||
timespent = SLRead[nextread] - RasterTiming;\
|
||||
timespent += EMFixNum; /* fixes edge marking bug emulation. not sure why this is needed? */\
|
||||
RasterTiming = (SLRead[nextread] + Arbitrary);\
|
||||
RasterTiming = SLRead[nextread];\
|
||||
}\
|
||||
scanlineswaiting--;\
|
||||
nextread++;\
|
||||
@ -1926,7 +1926,7 @@ void SoftRenderer::RenderPolygonsFast(GPU& gpu, Polygon** polygons, int npolys)
|
||||
|
||||
#define RENDER_SCANLINES(y)\
|
||||
/* update sl timeout */\
|
||||
ScanlineTimeout = SLRead[y-1] - FinalPassLen;\
|
||||
ScanlineTimeout = SLRead[y-1] - (PreReadCutoff+FinalPassLen);\
|
||||
\
|
||||
FindFirstPolyDoTimings(j, y, &firstpolyeven, &firstpolyodd, &rastertimingeven, &rastertimingodd);\
|
||||
RenderScanline<true>(gpu, y, firstpolyeven, j, &rastertimingeven);\
|
||||
@ -1951,7 +1951,7 @@ void SoftRenderer::RenderPolygonsTiming(GPU& gpu, Polygon** polygons, int npolys
|
||||
// reset scanline trackers
|
||||
gpu.GPU3D.UnderflowFlagVCount = -1;
|
||||
gpu.GPU3D.RDLinesTemp = 63;
|
||||
ScanlineTimeout = 0x7FFFFFFF; // CHECKME: first scanline pair timeout.
|
||||
ScanlineTimeout = SLRead[2] - (PreReadCutoff+FinalPassLen+4); // TEMP: should be infinity, but i dont want it to break due to not being set up to handle this properly. //0x7FFFFFFF; // CHECKME: first scanline pair timeout.
|
||||
s32 rastertimingeven, rastertimingodd; // always init to 0 at the start of a scanline render
|
||||
s32 scanlineswaiting = 0, slwaitingrd = 0;
|
||||
s32 nextread = 0, nextreadrd = 0;
|
||||
@ -1966,7 +1966,7 @@ void SoftRenderer::RenderPolygonsTiming(GPU& gpu, Polygon** polygons, int npolys
|
||||
// it can't proceed to the next scanline unless all others steps are done (both scanlines in the pair, and final pass)
|
||||
RasterTiming = timespent = std::max(std::initializer_list<s32> {rastertimingeven, rastertimingodd, FinalPassLen});
|
||||
// 12 cycles at the end of a "timeout" are always used for w/e reason
|
||||
RasterTiming += std::clamp(ScanlineTimeout - RasterTiming, 0, 12);
|
||||
RasterTiming += std::clamp(ScanlineTimeout - RasterTiming, 0, 12); // should probably just be += 12 tbh but i'll leave it for now
|
||||
|
||||
// if first pair was not delayed past the first read, then later scanlines cannot either
|
||||
// this allows us to implement a fast path
|
||||
|
Loading…
Reference in New Issue
Block a user