aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/GPU3D.cpp5
-rw-r--r--src/GPU3D.h1
-rw-r--r--src/GPU3D_Soft.cpp7
3 files changed, 6 insertions, 7 deletions
diff --git a/src/GPU3D.cpp b/src/GPU3D.cpp
index 4bb56ee..9179d46 100644
--- a/src/GPU3D.cpp
+++ b/src/GPU3D.cpp
@@ -751,11 +751,6 @@ void SubmitPolygon()
poly->Translucent = ((texfmt == 1 || texfmt == 6) && !(CurPolygonAttr & 0x10)) || (polyalpha > 0 && polyalpha < 31);
poly->IsShadowMask = ((CurPolygonAttr & 0x3F000030) == 0x00000030);
- if ((NumPolygons == 1) || (!CurPolygonRAM[NumPolygons-2].IsShadowMask))
- poly->ClearStencil = poly->IsShadowMask;
- else
- poly->ClearStencil = false;
-
poly->IsShadow = ((CurPolygonAttr & 0x30) == 0x30) && !poly->IsShadowMask;
if (LastStripPolygon && clipstart > 0)
diff --git a/src/GPU3D.h b/src/GPU3D.h
index bebdef0..6c1b43c 100644
--- a/src/GPU3D.h
+++ b/src/GPU3D.h
@@ -62,7 +62,6 @@ typedef struct
bool IsShadowMask;
bool IsShadow;
- bool ClearStencil;
// data below rather specific to the software renderer
diff --git a/src/GPU3D_Soft.cpp b/src/GPU3D_Soft.cpp
index d022e8a..fe97b5f 100644
--- a/src/GPU3D_Soft.cpp
+++ b/src/GPU3D_Soft.cpp
@@ -38,6 +38,7 @@ u32 AttrBuffer[256*192];
// bit30: translucent flag
u8 StencilBuffer[256*2];
+bool PrevIsShadowMask;
// threading
@@ -84,6 +85,8 @@ void Reset()
memset(DepthBuffer, 0, 256*192 * 4);
memset(AttrBuffer, 0, 256*192 * 4);
+ PrevIsShadowMask = false;
+
// TODO: make it configurable
if (!RenderThreadRunning)
{
@@ -803,9 +806,11 @@ void RenderPolygonScanline(RendererPolygon* rp, s32 y)
else
fnDepthTest = DepthTest<false>;
- if (polygon->ClearStencil)
+ if (polygon->IsShadowMask && !PrevIsShadowMask)
memset(&StencilBuffer[256 * (y&0x1)], 0, 256);
+ PrevIsShadowMask = polygon->IsShadowMask;
+
if (polygon->YTop != polygon->YBottom)
{
if (y >= polygon->Vertices[rp->NextVL]->FinalPosition[1] && rp->CurVL != polygon->VBottom)