From 087e711e449fe57a67a97b3af11e7735cedd6835 Mon Sep 17 00:00:00 2001 From: mtmasantana <245373187+mtmasantana@users.noreply.github.com> Date: Wed, 5 Aug 2026 14:04:43 -0500 Subject: [PATCH] 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 --- .../CodeGen/Spirv/Instructions.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs index 8bae96ef7..4d1999a47 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs @@ -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)