macOS: Fix NaN texture coordinates resolving toward max on Apple GPUs

- Fixes Animal Crossing: New Horizons backdrops being white instead of black

Patched applied from: https://github.com/Ryubing/Issues/issues/476
This commit is contained in:
mtmasantana
2026-08-05 14:04:43 -05:00
committed by KeatonTheBot
parent 9c46452388
commit 087e711e44
@@ -1241,6 +1241,23 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
SpvInstruction pCoords = AssemblePVector(pCount);
if (!intCoords)
{
SpvInstruction nfFp32 = context.TypeFP32();
SpvInstruction nfType = pCount > 1 ? context.TypeVector(nfFp32, pCount) : nfFp32;
SpvInstruction nfZero = context.Constant(nfFp32, 0f);
if (pCount > 1)
{
SpvInstruction[] nfElems = new SpvInstruction[pCount];
for (int nfI = 0; nfI < pCount; nfI++) { nfElems[nfI] = nfZero; }
nfZero = context.ConstantComposite(nfType, nfElems);
}
SpvInstruction nfBool = pCount > 1 ? context.TypeVector(context.TypeBool(), pCount) : context.TypeBool();
pCoords = context.Select(nfType, context.IsNan(nfBool, pCoords), nfZero, pCoords);
}
SpvInstruction AssembleDerivativesVector(int count)
{
if (count > 1)