mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-21 05:09:46 -06:00
GX: always latch rendering engine registers even when not flushing (similar to hardware).
This commit is contained in:
@ -2337,33 +2337,36 @@ bool YSort(Polygon* a, Polygon* b)
|
|||||||
|
|
||||||
void VBlank()
|
void VBlank()
|
||||||
{
|
{
|
||||||
if (GeometryEnabled && FlushRequest)
|
if (GeometryEnabled)
|
||||||
{
|
{
|
||||||
if (RenderingEnabled)
|
if (RenderingEnabled)
|
||||||
{
|
{
|
||||||
if (NumPolygons)
|
if (FlushRequest)
|
||||||
{
|
{
|
||||||
// separate translucent polygons from opaque ones
|
if (NumPolygons)
|
||||||
|
|
||||||
u32 io = 0, it = NumOpaquePolygons;
|
|
||||||
for (u32 i = 0; i < NumPolygons; i++)
|
|
||||||
{
|
{
|
||||||
Polygon* poly = &CurPolygonRAM[i];
|
// separate translucent polygons from opaque ones
|
||||||
if (poly->Translucent)
|
|
||||||
RenderPolygonRAM[it++] = poly;
|
u32 io = 0, it = NumOpaquePolygons;
|
||||||
else
|
for (u32 i = 0; i < NumPolygons; i++)
|
||||||
RenderPolygonRAM[io++] = poly;
|
{
|
||||||
|
Polygon* poly = &CurPolygonRAM[i];
|
||||||
|
if (poly->Translucent)
|
||||||
|
RenderPolygonRAM[it++] = poly;
|
||||||
|
else
|
||||||
|
RenderPolygonRAM[io++] = poly;
|
||||||
|
}
|
||||||
|
|
||||||
|
// apply Y-sorting
|
||||||
|
|
||||||
|
std::stable_sort(RenderPolygonRAM.begin(),
|
||||||
|
RenderPolygonRAM.begin() + ((FlushAttributes & 0x1) ? NumOpaquePolygons : NumPolygons),
|
||||||
|
YSort);
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply Y-sorting
|
RenderNumPolygons = NumPolygons;
|
||||||
|
|
||||||
std::stable_sort(RenderPolygonRAM.begin(),
|
|
||||||
RenderPolygonRAM.begin() + ((FlushAttributes & 0x1) ? NumOpaquePolygons : NumPolygons),
|
|
||||||
YSort);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderNumPolygons = NumPolygons;
|
|
||||||
|
|
||||||
RenderDispCnt = DispCnt;
|
RenderDispCnt = DispCnt;
|
||||||
RenderAlphaRef = AlphaRef;
|
RenderAlphaRef = AlphaRef;
|
||||||
|
|
||||||
@ -2381,15 +2384,18 @@ void VBlank()
|
|||||||
RenderClearAttr2 = ClearAttr2;
|
RenderClearAttr2 = ClearAttr2;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurRAMBank = CurRAMBank?0:1;
|
if (FlushRequest)
|
||||||
CurVertexRAM = &VertexRAM[CurRAMBank ? 6144 : 0];
|
{
|
||||||
CurPolygonRAM = &PolygonRAM[CurRAMBank ? 2048 : 0];
|
CurRAMBank = CurRAMBank?0:1;
|
||||||
|
CurVertexRAM = &VertexRAM[CurRAMBank ? 6144 : 0];
|
||||||
|
CurPolygonRAM = &PolygonRAM[CurRAMBank ? 2048 : 0];
|
||||||
|
|
||||||
NumVertices = 0;
|
NumVertices = 0;
|
||||||
NumPolygons = 0;
|
NumPolygons = 0;
|
||||||
NumOpaquePolygons = 0;
|
NumOpaquePolygons = 0;
|
||||||
|
|
||||||
FlushRequest = 0;
|
FlushRequest = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user