macOS: Fix NaN texture coordinates resolving toward max on Apple GPUs (#182)

This PR fixes Animal Crossing: New Horizons backdrops on Apple Silicon being white instead of black. Credit to [mtmasantana](https://github.com/mtmasantana) for the fix.

More info on the Issues page: https://github.com/Ryubing/Issues/issues/476

![acnh-white-bg](/attachments/980555c7-1796-4999-a98e-aa16d43fc533)

![acnh-black-bg-fixed](/attachments/26464cfe-a9e4-43ab-886c-aae90834ee08)

Co-authored-by: mtmasantana <245373187+mtmasantana@users.noreply.github.com>
Reviewed-on: https://git.ryujinx.app/projects/Ryubing/pulls/182
This commit is contained in:
KeatonTheBot
2026-08-24 19:21:19 +00:00
committed by LotP
co-authored by mtmasantana
parent b251318225
commit e2a612b114
@@ -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)