SoftRasterizer: Tiny optimization to rasterization if a shadow polygon is used, taking advantage of an already existing hint.

This commit is contained in:
rogerman 2017-11-17 19:18:14 -08:00
parent d0c0a5641a
commit e5694abd63
1 changed files with 8 additions and 1 deletions

View File

@ -430,8 +430,15 @@ public:
}
}
template <bool ISSHADOWPOLYGON>
FORCEINLINE void shade(const PolygonMode polygonMode, const FragmentColor src, FragmentColor &dst, const float texCoordU, const float texCoordV)
{
if (ISSHADOWPOLYGON)
{
dst = src;
return;
}
static const FragmentColor colorWhite = MakeFragmentColor(0x3F, 0x3F, 0x3F, 0x1F);
const FragmentColor mainTexColor = (this->currentTexture->IsSamplingEnabled()) ? sample(texCoordU, texCoordV) : colorWhite;
@ -599,7 +606,7 @@ public:
polyAttr.Alpha);
//pixel shader
shade((PolygonMode)polyAttr.Mode, srcColor, shaderOutput, invu * w, invv * w);
shade<ISSHADOWPOLYGON>((PolygonMode)polyAttr.Mode, srcColor, shaderOutput, invu * w, invv * w);
// handle alpha test
if ( shaderOutput.a == 0 ||