minor tweaks to edge marking bug handling

for some reason it does not check against the depth bitmap when enabled?
This commit is contained in:
Jaklyy 2024-03-05 17:46:13 -05:00
parent 56e506ef9a
commit bbbd56877d
2 changed files with 15 additions and 17 deletions

View File

@ -1544,19 +1544,17 @@ bool SoftRenderer::CheckEdgeMarkingPixel(u32 polyid, u32 z, u32 pixeladdr)
else return false; else return false;
} }
bool CheckEdgeMarkingClearPlane(const GPU3D& gpu3d, u32 polyid, u32 z, u32 pixeladdr) bool SoftRenderer::CheckEdgeMarkingClearPlane(const GPU3D& gpu3d, u32 polyid, u32 z)
{ {
if (gpu3d.RenderDispCnt & (1<<14)) // for some reason it never checks against the bitmap clear plane?
{ if (polyid != gpu3d.RenderClearAttr1>>24)
return true;
}
else
{ {
u32 clearz = ((gpu3d.RenderClearAttr2 & 0x7FFF) * 0x200) + 0x1FF; u32 clearz = ((gpu3d.RenderClearAttr2 & 0x7FFF) * 0x200) + 0x1FF;
if ((polyid != gpu3d.RenderClearAttr1>>24) && (z < clearz)) return true; if (z < clearz) return true;
else return false; else return false;
} }
else return false;
} }
template <bool push> template <bool push>
@ -1582,14 +1580,14 @@ void SoftRenderer::ScanlineFinalPass(const GPU3D& gpu3d, s32 y, bool checkprev,
u32 z = DepthBuffer[pixeladdr]; u32 z = DepthBuffer[pixeladdr];
bool doit = false; bool doit = false;
if ((checkprev && (x == 0) && CheckEdgeMarkingClearPlane(gpu3d, polyid, z, pixeladdr+1)) || if ((checkprev && (x == 0) && CheckEdgeMarkingClearPlane(gpu3d, polyid, z)) || // left
(checknext && (x == 255) && CheckEdgeMarkingClearPlane(gpu3d, polyid, z, pixeladdr+1)) || (checknext && (x == 255) && CheckEdgeMarkingClearPlane(gpu3d, polyid, z)) || // right
((y == 0) && CheckEdgeMarkingClearPlane(gpu3d, polyid, z, pixeladdr-ScanlineWidth)) || ((y == 0) && CheckEdgeMarkingClearPlane(gpu3d, polyid, z)) || // top
((y == 191) && CheckEdgeMarkingClearPlane(gpu3d, polyid, z, pixeladdr+ScanlineWidth)) || ((y == 191) && CheckEdgeMarkingClearPlane(gpu3d, polyid, z)) || // bottom
((x != 0) && CheckEdgeMarkingPixel(polyid, z, pixeladdr-1)) || ((x != 0) && CheckEdgeMarkingPixel(polyid, z, pixeladdr-1)) || // left
((x != 255) && CheckEdgeMarkingPixel(polyid, z, pixeladdr+1)) || ((x != 255) && CheckEdgeMarkingPixel(polyid, z, pixeladdr+1)) || // right
((y != 0) && CheckEdgeMarkingPixel(polyid, z, pixeladdr-ScanlineWidth)) || ((y != 0) && CheckEdgeMarkingPixel(polyid, z, pixeladdr-ScanlineWidth)) || // top
((y != 191) && CheckEdgeMarkingPixel(polyid, z, pixeladdr+ScanlineWidth))) ((y != 191) && CheckEdgeMarkingPixel(polyid, z, pixeladdr+ScanlineWidth))) // bottom
{ {
u16 edgecolor = gpu3d.RenderEdgeTable[polyid >> 3]; u16 edgecolor = gpu3d.RenderEdgeTable[polyid >> 3];
u32 edgeR = (edgecolor << 1) & 0x3E; if (edgeR) edgeR++; u32 edgeR = (edgecolor << 1) & 0x3E; if (edgeR) edgeR++;

View File

@ -472,8 +472,8 @@ private:
void RenderScanline(const GPU& gpu, s32 y, int npolys, s32* timingcounter); void RenderScanline(const GPU& gpu, s32 y, int npolys, s32* timingcounter);
u32 CalculateFogDensity(const GPU3D& gpu3d, u32 pixeladdr) const; u32 CalculateFogDensity(const GPU3D& gpu3d, u32 pixeladdr) const;
bool CheckEdgeMarkingPixel(u32 polyid, u32 z, u32 pixeladdr); bool CheckEdgeMarkingPixel(u32 polyid, u32 z, u32 pixeladdr);
template <bool push> bool CheckEdgeMarkingClearPlane(const GPU3D& gpu3d, u32 polyid, u32 z);
void ScanlineFinalPass(const GPU3D& gpu3d, s32 y, bool checkprev, bool checknext); template <bool push> void ScanlineFinalPass(const GPU3D& gpu3d, s32 y, bool checkprev, bool checknext);
void ClearBuffers(const GPU& gpu); void ClearBuffers(const GPU& gpu);
u16 BeginPushScanline(s32 y, s32 pixelstodraw); u16 BeginPushScanline(s32 y, s32 pixelstodraw);
void ReadScanline(s32 y); void ReadScanline(s32 y);