From 4a65260655017a9e00376facc916823cad745cca Mon Sep 17 00:00:00 2001 From: Samuliak Date: Thu, 16 May 2024 16:33:46 +0200 Subject: [PATCH] fix: pass array index as an additional argument to sample --- .../CodeGen/Msl/Instructions/InstGenMemory.cs | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs index 6639445e7..217c21816 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs @@ -184,13 +184,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions int pCount = coordsCount; - int arrayIndexElem = -1; - - if (isArray) - { - arrayIndexElem = pCount++; - } - if (isShadow && !isGather) { pCount++; @@ -211,19 +204,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions for (int index = 0; index < count; index++) { - if (arrayIndexElem == index) - { - elems[index] = Src(AggregateType.S32); - - if (!intCoords) - { - elems[index] = "float(" + elems[index] + ")"; - } - } - else - { - elems[index] = Src(coordType); - } + elems[index] = Src(coordType); } string prefix = intCoords ? "int" : "float"; @@ -238,6 +219,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions Append(AssemblePVector(pCount)); + if (isArray) + { + texCall += ", " + Src(AggregateType.S32); + } + texCall += ")" + (colorIsVector ? GetMaskMultiDest(texOp.Index) : ""); return texCall;