diff --git a/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs b/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs index 7196df9efd..0c9ef87f7e 100644 --- a/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs +++ b/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs @@ -1393,11 +1393,11 @@ namespace Ryujinx.Graphics.Gal.Shader } - private string GetTextureOffset(ShaderIrMetaTex Meta, string Oper) + private string GetTextureOffset(ShaderIrMetaTex Meta, string Oper, int Shift = 4, int Mask = 0xF) { - string GetOffset(string Operation, int index) + string GetOffset(string Operation, int Index) { - return "(" + Operation + " >> " + index * 4 + ") & 0xF"; + return $"({Operation} >> {Index * Shift}) & 0x{Mask:x}"; } int Coords = ImageUtils.GetCoordsCountTextureTarget(Meta.TextureTarget); @@ -1435,8 +1435,13 @@ namespace Ryujinx.Graphics.Gal.Shader Comp = GetOperExpr(Op, Meta.DepthCompare); } - // TODO: Support AOFFI if ((Suffix & TextureInstructionSuffix.AOffI) != 0) + { + string Offset = GetTextureOffset(Meta, "floatBitsToInt((" + GetOperExpr(Op, Meta.Offset) + "))", 8, 0x3F); + return "textureGatherOffset(" + Sampler + ", " + Coords + ", " + Comp + ", " + Offset + ")" + ChString; + } + // TODO: Support PTP + else if ((Suffix & TextureInstructionSuffix.PTP) != 0) { throw new NotImplementedException(); } diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs index e0a4132192..38cd83eb37 100644 --- a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs +++ b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs @@ -475,7 +475,7 @@ namespace Ryujinx.Graphics.Gal.Shader { TextureInstructionSuffix Suffix; - int RawSuffix = OpCode.Read(0x34, 0x38); + int RawSuffix = OpCode.Read(0x34, 0xc); switch (RawSuffix) {