Support AOFFI with TLD4 and TLD4S

This commit is contained in:
Thog 2018-12-09 16:43:04 +01:00
commit 6dc88c85c9
No known key found for this signature in database
GPG key ID: 0CD291558FAFDBC6
2 changed files with 10 additions and 5 deletions

View file

@ -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); int Coords = ImageUtils.GetCoordsCountTextureTarget(Meta.TextureTarget);
@ -1435,8 +1435,13 @@ namespace Ryujinx.Graphics.Gal.Shader
Comp = GetOperExpr(Op, Meta.DepthCompare); Comp = GetOperExpr(Op, Meta.DepthCompare);
} }
// TODO: Support AOFFI
if ((Suffix & TextureInstructionSuffix.AOffI) != 0) 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(); throw new NotImplementedException();
} }

View file

@ -475,7 +475,7 @@ namespace Ryujinx.Graphics.Gal.Shader
{ {
TextureInstructionSuffix Suffix; TextureInstructionSuffix Suffix;
int RawSuffix = OpCode.Read(0x34, 0x38); int RawSuffix = OpCode.Read(0x34, 0xc);
switch (RawSuffix) switch (RawSuffix)
{ {