diff --git a/Ryujinx.Graphics/Shader/Decoders/OpCodeTable.cs b/Ryujinx.Graphics/Shader/Decoders/OpCodeTable.cs index d1216fced3..e7ae37db53 100644 --- a/Ryujinx.Graphics/Shader/Decoders/OpCodeTable.cs +++ b/Ryujinx.Graphics/Shader/Decoders/OpCodeTable.cs @@ -132,8 +132,8 @@ namespace Ryujinx.Graphics.Shader.Decoders Set("110000xxxx111x", InstEmit.Tex, typeof(OpCodeTex)); Set("1101111010111x", InstEmit.Tex_B, typeof(OpCodeTex)); Set("1101x00xxxxxxx", InstEmit.Texs, typeof(OpCodeTexs)); - Set("1101101xxxxxxx", InstEmit.Texs, typeof(OpCodeTlds)); - Set("1101111100xxxx", InstEmit.Texs, typeof(OpCodeTld4s)); + Set("1101x01xxxxxxx", InstEmit.Texs, typeof(OpCodeTlds)); + Set("1101x11100xxxx", InstEmit.Texs, typeof(OpCodeTld4s)); Set("1101110000111x", InstEmit.Tld, typeof(OpCodeTld)); Set("1101110100111x", InstEmit.Tld_B, typeof(OpCodeTld)); Set("110010xxxx111x", InstEmit.Tld4, typeof(OpCodeTld4)); diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitMemory.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitMemory.cs index 819e273f6c..e001afaac2 100644 --- a/Ryujinx.Graphics/Shader/Instructions/InstEmitMemory.cs +++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitMemory.cs @@ -273,7 +273,7 @@ namespace Ryujinx.Graphics.Shader.Instructions { case TldsType.Texture1DLodZero: sourcesList.Add(Ra()); - sourcesList.Add(ConstF(0)); + sourcesList.Add(Const(0)); break; case TldsType.Texture1DLodLevel: @@ -284,14 +284,14 @@ namespace Ryujinx.Graphics.Shader.Instructions case TldsType.Texture2DLodZero: sourcesList.Add(Ra()); sourcesList.Add(Rb()); - sourcesList.Add(ConstF(0)); + sourcesList.Add(Const(0)); break; case TldsType.Texture2DLodZeroOffset: case TldsType.Texture2DLodZeroMultisample: sourcesList.Add(Ra()); sourcesList.Add(Ra()); - sourcesList.Add(ConstF(0)); + sourcesList.Add(Const(0)); sourcesList.Add(Rb()); break; @@ -305,14 +305,14 @@ namespace Ryujinx.Graphics.Shader.Instructions sourcesList.Add(Ra()); sourcesList.Add(Ra()); sourcesList.Add(Rb()); - sourcesList.Add(ConstF(0)); + sourcesList.Add(Const(0)); break; case TldsType.Texture2DArrayLodZero: sourcesList.Add(Rb()); sourcesList.Add(Rb()); sourcesList.Add(Ra()); - sourcesList.Add(ConstF(0)); + sourcesList.Add(Const(0)); break; case TldsType.Texture2DLodLevelOffset: @@ -339,19 +339,26 @@ namespace Ryujinx.Graphics.Shader.Instructions type = TextureType.Texture2D; flags = TextureFlags.Gather; - if (tld4sOp.HasOffset) - { - sourcesList.Add(Rb()); - - flags |= TextureFlags.Offset; - } - if (tld4sOp.HasDepthCompare) { sourcesList.Add(Rb()); type |= TextureType.Shadow; } + + if (tld4sOp.HasOffset) + { + Operand packedOffs = Rb(); + + for (int index = 0; index < type.GetCoordsCount(); index++) + { + sourcesList.Add(context.BitfieldExtractS32(packedOffs, Const(index * 8), Const(6))); + } + + flags |= TextureFlags.Offset; + } + + sourcesList.Add(Const(tld4sOp.GatherCompIndex)); } else {