Software: Remove normalization special case

The special case doesn't appear to make a significant difference in any games, and the current implementation has a (minor, fixable) issue that breaks Super Mario Sunshine (both with a failed assertion (https://bugs.dolphin-emu.org/issues/11742) and a rendering issue (https://bugs.dolphin-emu.org/issues/7476)).  Hardware testing wasn't able to reproduce the special case, either, so it may just not exist.

PR #9315 contains a fixed implementation of the special case on all video backends, and can serve as a basis for it being reintroduced if it is found to exist under more specific circumstances.  For now, I don't see a reason to keep it present.
This commit is contained in:
Pokechu22
2021-01-03 23:22:48 -08:00
parent e957ed0809
commit e825af7b1b
4 changed files with 10 additions and 34 deletions

View File

@ -109,7 +109,7 @@ void TransformNormal(const InputVertexData* src, bool nbt, OutputVertexData* dst
}
}
static void TransformTexCoordRegular(const TexMtxInfo& texinfo, int coordNum, bool specialCase,
static void TransformTexCoordRegular(const TexMtxInfo& texinfo, int coordNum,
const InputVertexData* srcVertex, OutputVertexData* dstVertex)
{
Vec3 src;
@ -140,15 +140,13 @@ static void TransformTexCoordRegular(const TexMtxInfo& texinfo, int coordNum, bo
if (texinfo.projection == XF_TEXPROJ_ST)
{
if (texinfo.inputform == XF_TEXINPUT_AB11 || specialCase)
if (texinfo.inputform == XF_TEXINPUT_AB11)
MultiplyVec2Mat24(src, mat, *dst);
else
MultiplyVec3Mat24(src, mat, *dst);
}
else // texinfo.projection == XF_TEXPROJ_STQ
{
ASSERT(!specialCase);
if (texinfo.inputform == XF_TEXINPUT_AB11)
MultiplyVec2Mat34(src, mat, *dst);
else
@ -163,27 +161,12 @@ static void TransformTexCoordRegular(const TexMtxInfo& texinfo, int coordNum, bo
const PostMtxInfo& postInfo = xfmem.postMtxInfo[coordNum];
const float* postMat = &xfmem.postMatrices[postInfo.index * 4];
if (specialCase)
{
// no normalization
// q of input is 1
// q of output is unknown
tempCoord.x = dst->x;
tempCoord.y = dst->y;
dst->x = postMat[0] * tempCoord.x + postMat[1] * tempCoord.y + postMat[2] + postMat[3];
dst->y = postMat[4] * tempCoord.x + postMat[5] * tempCoord.y + postMat[6] + postMat[7];
dst->z = 1.0f;
}
if (postInfo.normalize)
tempCoord = dst->Normalized();
else
{
if (postInfo.normalize)
tempCoord = dst->Normalized();
else
tempCoord = *dst;
tempCoord = *dst;
MultiplyVec3Mat34(tempCoord, postMat, *dst);
}
MultiplyVec3Mat34(tempCoord, postMat, *dst);
}
// When q is 0, the GameCube appears to have a special case
@ -406,7 +389,7 @@ void TransformColor(const InputVertexData* src, OutputVertexData* dst)
}
}
void TransformTexCoord(const InputVertexData* src, OutputVertexData* dst, bool specialCase)
void TransformTexCoord(const InputVertexData* src, OutputVertexData* dst)
{
for (u32 coordNum = 0; coordNum < xfmem.numTexGen.numTexGens; coordNum++)
{
@ -415,7 +398,7 @@ void TransformTexCoord(const InputVertexData* src, OutputVertexData* dst, bool s
switch (texinfo.texgentype)
{
case XF_TEXGEN_REGULAR:
TransformTexCoordRegular(texinfo, coordNum, specialCase, src, dst);
TransformTexCoordRegular(texinfo, coordNum, src, dst);
break;
case XF_TEXGEN_EMBOSS_MAP:
{