mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
even more cleanup!
This commit is contained in:
parent
57e590269f
commit
635bfa0c29
@ -74,7 +74,6 @@ GPU::GPU(melonDS::NDS& nds, std::unique_ptr<Renderer3D>&& renderer3d, std::uniqu
|
|||||||
NDS.RegisterEventFunc(Event_LCD, LCD_StartScanline, MemberEventFunc(GPU, StartScanline));
|
NDS.RegisterEventFunc(Event_LCD, LCD_StartScanline, MemberEventFunc(GPU, StartScanline));
|
||||||
NDS.RegisterEventFunc(Event_LCD, LCD_FinishFrame, MemberEventFunc(GPU, FinishFrame));
|
NDS.RegisterEventFunc(Event_LCD, LCD_FinishFrame, MemberEventFunc(GPU, FinishFrame));
|
||||||
NDS.RegisterEventFunc(Event_DisplayFIFO, 0, MemberEventFunc(GPU, DisplayFIFO));
|
NDS.RegisterEventFunc(Event_DisplayFIFO, 0, MemberEventFunc(GPU, DisplayFIFO));
|
||||||
NDS.RegisterEventFunc(Event_DisplayFIFO, 0, MemberEventFunc(GPU, DisplayFIFO));
|
|
||||||
|
|
||||||
InitFramebuffers();
|
InitFramebuffers();
|
||||||
}
|
}
|
||||||
@ -916,6 +915,7 @@ void GPU::StartHBlank(u32 line) noexcept
|
|||||||
|
|
||||||
if (DispStat[0] & (1<<4)) NDS.SetIRQ(0, IRQ_HBlank);
|
if (DispStat[0] & (1<<4)) NDS.SetIRQ(0, IRQ_HBlank);
|
||||||
if (DispStat[1] & (1<<4)) NDS.SetIRQ(1, IRQ_HBlank);
|
if (DispStat[1] & (1<<4)) NDS.SetIRQ(1, IRQ_HBlank);
|
||||||
|
|
||||||
if (VCount < 262)
|
if (VCount < 262)
|
||||||
NDS.ScheduleEvent(Event_LCD, true, (LINE_CYCLES - HBLANK_CYCLES), LCD_StartScanline, line+1);
|
NDS.ScheduleEvent(Event_LCD, true, (LINE_CYCLES - HBLANK_CYCLES), LCD_StartScanline, line+1);
|
||||||
else
|
else
|
||||||
|
@ -821,6 +821,8 @@ void GPU3D::StallPolygonPipeline(s32 delay, s32 nonstalldelay) noexcept
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<int comp, s32 plane, bool attribs>
|
template<int comp, s32 plane, bool attribs>
|
||||||
void ClipSegment(Vertex* outbuf, Vertex* vin, Vertex* vout)
|
void ClipSegment(Vertex* outbuf, Vertex* vin, Vertex* vout)
|
||||||
{
|
{
|
||||||
@ -2678,7 +2680,7 @@ u16 GPU3D::Read16(u32 addr) noexcept
|
|||||||
return DispCnt;
|
return DispCnt;
|
||||||
|
|
||||||
case 0x04000320:
|
case 0x04000320:
|
||||||
return RDLines; // CHECKME: Can this always be read? Even when the gpu is powered off? also check 8 bit reads
|
return RDLines;
|
||||||
|
|
||||||
case 0x04000600:
|
case 0x04000600:
|
||||||
{
|
{
|
||||||
|
@ -972,7 +972,7 @@ bool SoftRenderer::RenderShadowMaskScanline(const GPU3D& gpu3d, RendererPolygon*
|
|||||||
}
|
}
|
||||||
else abortscanline = false;
|
else abortscanline = false;
|
||||||
}
|
}
|
||||||
else abortscanline = true;
|
// note: if accuracy mode isn't enabled the abort flag never gets set, this is fine, because it also never gets used by fast mode.
|
||||||
|
|
||||||
// for shadow masks: set stencil bits where the depth test fails.
|
// for shadow masks: set stencil bits where the depth test fails.
|
||||||
// draw nothing.
|
// draw nothing.
|
||||||
@ -1227,7 +1227,7 @@ bool SoftRenderer::RenderPolygonScanline(const GPU& gpu, RendererPolygon* rp, s3
|
|||||||
}
|
}
|
||||||
else abortscanline = false;
|
else abortscanline = false;
|
||||||
}
|
}
|
||||||
else abortscanline = false;
|
// note: if accuracy mode isn't enabled the abort flag never gets set, this is fine, because it also never gets used by fast mode.
|
||||||
|
|
||||||
// part 1: left edge
|
// part 1: left edge
|
||||||
edge = yedge | 0x1;
|
edge = yedge | 0x1;
|
||||||
@ -1239,7 +1239,6 @@ bool SoftRenderer::RenderPolygonScanline(const GPU& gpu, RendererPolygon* rp, s3
|
|||||||
if (xcov == 0x3FF) xcov = 0;
|
if (xcov == 0x3FF) xcov = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!l_filledge) x = xlimit;
|
if (!l_filledge) x = xlimit;
|
||||||
else for (; x < xlimit; x++)
|
else for (; x < xlimit; x++)
|
||||||
{
|
{
|
||||||
@ -1882,6 +1881,7 @@ void SoftRenderer::ClearBuffers(const GPU& gpu)
|
|||||||
|
|
||||||
void SoftRenderer::RenderPolygonsFast(GPU& gpu, Polygon** polygons, int npolys)
|
void SoftRenderer::RenderPolygonsFast(GPU& gpu, Polygon** polygons, int npolys)
|
||||||
{
|
{
|
||||||
|
gpu.GPU3D.RDLinesTemp = 46; // dumb way of making sure it gets updated to a "normal" value when the gpu starts rasterizing.
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (int i = 0; i < npolys; i++)
|
for (int i = 0; i < npolys; i++)
|
||||||
{
|
{
|
||||||
|
@ -488,16 +488,6 @@ private:
|
|||||||
s32 ScanlineTimeout;
|
s32 ScanlineTimeout;
|
||||||
s32 RasterTiming;
|
s32 RasterTiming;
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
RenderStart = 0,
|
|
||||||
ScanlineRead,
|
|
||||||
PushScanline,
|
|
||||||
PushScanlineP2,
|
|
||||||
RenderFinal,
|
|
||||||
RasterEvents_MAX,
|
|
||||||
};
|
|
||||||
|
|
||||||
// buffer dimensions are 258x194 to add a offscreen 1px border
|
// buffer dimensions are 258x194 to add a offscreen 1px border
|
||||||
// which simplifies edge marking tests
|
// which simplifies edge marking tests
|
||||||
// buffer is duplicated to keep track of the two topmost pixels
|
// buffer is duplicated to keep track of the two topmost pixels
|
||||||
@ -506,16 +496,16 @@ private:
|
|||||||
|
|
||||||
static constexpr int ScanlineWidth = 256;
|
static constexpr int ScanlineWidth = 256;
|
||||||
static constexpr int NumScanlinesIntBuf = 192;
|
static constexpr int NumScanlinesIntBuf = 192;
|
||||||
static constexpr int NumScanlinesRD = 48;
|
//static constexpr int NumScanlinesRD = 48;
|
||||||
static constexpr int NumScanlinesFinal = 192;
|
static constexpr int NumScanlinesFinal = 192;
|
||||||
static constexpr int BufferSize = ScanlineWidth * NumScanlinesIntBuf;
|
static constexpr int BufferSize = ScanlineWidth * NumScanlinesIntBuf;
|
||||||
static constexpr int RDBufferSize = ScanlineWidth * NumScanlinesRD;
|
//static constexpr int RDBufferSize = ScanlineWidth * NumScanlinesRD;
|
||||||
static constexpr int FinalBufferSize = ScanlineWidth * NumScanlinesFinal;
|
static constexpr int FinalBufferSize = ScanlineWidth * NumScanlinesFinal;
|
||||||
|
|
||||||
u32 ColorBuffer[BufferSize * 2];
|
u32 ColorBuffer[BufferSize * 2];
|
||||||
u32 DepthBuffer[BufferSize * 2];
|
u32 DepthBuffer[BufferSize * 2];
|
||||||
u32 AttrBuffer[BufferSize * 2];
|
u32 AttrBuffer[BufferSize * 2];
|
||||||
u32 RDBuffer[RDBufferSize]; // is this buffer ever initialized by hw before writing to it? what is its initial value? can you transfer 3d framebuffer data between games?
|
//u32 RDBuffer[RDBufferSize]; // is this buffer ever initialized by hw before writing to it? what is its initial value? can you transfer 3d framebuffer data between games?
|
||||||
u32 FinalBuffer[FinalBufferSize];
|
u32 FinalBuffer[FinalBufferSize];
|
||||||
|
|
||||||
// attribute buffer:
|
// attribute buffer:
|
||||||
|
Loading…
Reference in New Issue
Block a user