Remove GetSuffix local functions
This commit is contained in:
parent
fb228c3be7
commit
78d55796af
1 changed files with 131 additions and 111 deletions
|
@ -201,69 +201,78 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public static void Tex(ShaderIrBlock Block, long OpCode, int Position)
|
public static void Tex(ShaderIrBlock Block, long OpCode, int Position)
|
||||||
{
|
{
|
||||||
TextureInstructionSuffix GetSuffix()
|
TextureInstructionSuffix Suffix;
|
||||||
{
|
|
||||||
int Suffix = OpCode.Read(0x34, 0x38);
|
|
||||||
|
|
||||||
switch (Suffix)
|
int RawSuffix = OpCode.Read(0x34, 0x38);
|
||||||
{
|
|
||||||
case 0:
|
switch (RawSuffix)
|
||||||
return TextureInstructionSuffix.None;
|
{
|
||||||
case 0x8:
|
case 0:
|
||||||
return TextureInstructionSuffix.LZ;
|
Suffix = TextureInstructionSuffix.None;
|
||||||
case 0x10:
|
break;
|
||||||
return TextureInstructionSuffix.LB;
|
case 0x8:
|
||||||
case 0x18:
|
Suffix = TextureInstructionSuffix.LZ;
|
||||||
return TextureInstructionSuffix.LL;
|
break;
|
||||||
case 0x30:
|
case 0x10:
|
||||||
return TextureInstructionSuffix.LBA;
|
Suffix = TextureInstructionSuffix.LB;
|
||||||
case 0x38:
|
break;
|
||||||
return TextureInstructionSuffix.LLA;
|
case 0x18:
|
||||||
default:
|
Suffix = TextureInstructionSuffix.LL;
|
||||||
throw new InvalidOperationException($"Invalid Suffix for TEX instruction {Suffix}");
|
break;
|
||||||
}
|
case 0x30:
|
||||||
|
Suffix = TextureInstructionSuffix.LBA;
|
||||||
|
break;
|
||||||
|
case 0x38:
|
||||||
|
Suffix = TextureInstructionSuffix.LLA;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new InvalidOperationException($"Invalid Suffix for TEX instruction {RawSuffix}");
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureInstructionSuffix InstructionSuffix = GetSuffix();
|
|
||||||
bool IsOffset = OpCode.Read(0x36);
|
bool IsOffset = OpCode.Read(0x36);
|
||||||
|
|
||||||
if (IsOffset)
|
if (IsOffset)
|
||||||
InstructionSuffix |= TextureInstructionSuffix.AOFFI;
|
Suffix |= TextureInstructionSuffix.AOFFI;
|
||||||
|
|
||||||
EmitTex(Block, OpCode, InstructionSuffix, GprHandle: false);
|
EmitTex(Block, OpCode, Suffix, GprHandle: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Tex_B(ShaderIrBlock Block, long OpCode, int Position)
|
public static void Tex_B(ShaderIrBlock Block, long OpCode, int Position)
|
||||||
{
|
{
|
||||||
TextureInstructionSuffix GetSuffix()
|
TextureInstructionSuffix Suffix;
|
||||||
|
|
||||||
|
int RawSuffix = OpCode.Read(0x24, 0xe);
|
||||||
|
|
||||||
|
switch (RawSuffix)
|
||||||
{
|
{
|
||||||
int Suffix = OpCode.Read(0x24, 0xe);
|
case 0:
|
||||||
switch (Suffix)
|
Suffix = TextureInstructionSuffix.None;
|
||||||
{
|
break;
|
||||||
case 0:
|
case 0x2:
|
||||||
return TextureInstructionSuffix.None;
|
Suffix = TextureInstructionSuffix.LZ;
|
||||||
case 0x2:
|
break;
|
||||||
return TextureInstructionSuffix.LZ;
|
case 0x4:
|
||||||
case 0x4:
|
Suffix = TextureInstructionSuffix.LB;
|
||||||
return TextureInstructionSuffix.LB;
|
break;
|
||||||
case 0x6:
|
case 0x6:
|
||||||
return TextureInstructionSuffix.LL;
|
Suffix = TextureInstructionSuffix.LL;
|
||||||
case 0xC:
|
break;
|
||||||
return TextureInstructionSuffix.LBA;
|
case 0xc:
|
||||||
case 0xE:
|
Suffix = TextureInstructionSuffix.LBA;
|
||||||
return TextureInstructionSuffix.LLA;
|
break;
|
||||||
default:
|
case 0xe:
|
||||||
throw new InvalidOperationException($"Invalid Suffix for TEX.B instruction {Suffix}");
|
Suffix = TextureInstructionSuffix.LLA;
|
||||||
}
|
break;
|
||||||
|
default:
|
||||||
|
throw new InvalidOperationException($"Invalid Suffix for TEX.B instruction {RawSuffix}");
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureInstructionSuffix InstructionSuffix = GetSuffix();
|
|
||||||
bool IsOffset = OpCode.Read(0x23);
|
bool IsOffset = OpCode.Read(0x23);
|
||||||
|
|
||||||
if (IsOffset)
|
if (IsOffset)
|
||||||
InstructionSuffix |= TextureInstructionSuffix.AOFFI;
|
Suffix |= TextureInstructionSuffix.AOFFI;
|
||||||
|
|
||||||
EmitTex(Block, OpCode, InstructionSuffix, GprHandle: true);
|
EmitTex(Block, OpCode, Suffix, GprHandle: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void EmitTex(ShaderIrBlock Block, long OpCode, TextureInstructionSuffix TextureInstructionSuffix, bool GprHandle)
|
private static void EmitTex(ShaderIrBlock Block, long OpCode, TextureInstructionSuffix TextureInstructionSuffix, bool GprHandle)
|
||||||
|
@ -385,89 +394,102 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public static void Texs(ShaderIrBlock Block, long OpCode, int Position)
|
public static void Texs(ShaderIrBlock Block, long OpCode, int Position)
|
||||||
{
|
{
|
||||||
TextureInstructionSuffix GetSuffix()
|
TextureInstructionSuffix Suffix;
|
||||||
|
|
||||||
|
int RawSuffix = OpCode.Read(0x34, 0x1e);
|
||||||
|
|
||||||
|
switch (RawSuffix)
|
||||||
{
|
{
|
||||||
int Suffix = OpCode.Read(0x34, 0x1e);
|
case 0:
|
||||||
switch (Suffix)
|
case 0x4:
|
||||||
{
|
case 0x10:
|
||||||
case 0:
|
case 0x16:
|
||||||
case 0x4:
|
Suffix = TextureInstructionSuffix.LZ;
|
||||||
case 0x10:
|
break;
|
||||||
case 0x16:
|
case 0x6:
|
||||||
return TextureInstructionSuffix.LZ;
|
case 0x1a:
|
||||||
case 0x6:
|
Suffix = TextureInstructionSuffix.LL;
|
||||||
case 0x1a:
|
break;
|
||||||
return TextureInstructionSuffix.LL;
|
case 0x8:
|
||||||
case 0x8:
|
Suffix = TextureInstructionSuffix.DC;
|
||||||
return TextureInstructionSuffix.DC;
|
break;
|
||||||
case 0x2:
|
case 0x2:
|
||||||
case 0xe:
|
case 0xe:
|
||||||
case 0x14:
|
case 0x14:
|
||||||
case 0x18:
|
case 0x18:
|
||||||
return TextureInstructionSuffix.None;
|
Suffix = TextureInstructionSuffix.None;
|
||||||
case 0xa:
|
break;
|
||||||
return TextureInstructionSuffix.LL | TextureInstructionSuffix.DC;
|
case 0xa:
|
||||||
case 0xc:
|
Suffix = TextureInstructionSuffix.LL | TextureInstructionSuffix.DC;
|
||||||
case 0x12:
|
break;
|
||||||
return TextureInstructionSuffix.LZ | TextureInstructionSuffix.DC;
|
case 0xc:
|
||||||
default:
|
case 0x12:
|
||||||
throw new InvalidOperationException($"Invalid Suffix for TEXS instruction {Suffix}");
|
Suffix = TextureInstructionSuffix.LZ | TextureInstructionSuffix.DC;
|
||||||
}
|
break;
|
||||||
|
default:
|
||||||
|
throw new InvalidOperationException($"Invalid Suffix for TEXS instruction {RawSuffix}");
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureType TextureType = TexsToTextureType(OpCode.Read(52, 0x1e));
|
TextureType TextureType = TexsToTextureType(OpCode.Read(52, 0x1e));
|
||||||
|
|
||||||
EmitTexs(Block, OpCode, ShaderIrInst.Texs, TextureType, GetSuffix());
|
EmitTexs(Block, OpCode, ShaderIrInst.Texs, TextureType, Suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Tlds(ShaderIrBlock Block, long OpCode, int Position)
|
public static void Tlds(ShaderIrBlock Block, long OpCode, int Position)
|
||||||
{
|
{
|
||||||
TextureInstructionSuffix GetSuffix()
|
TextureInstructionSuffix Suffix;
|
||||||
|
|
||||||
|
int RawSuffix = OpCode.Read(0x34, 0x1e);
|
||||||
|
|
||||||
|
switch (RawSuffix)
|
||||||
{
|
{
|
||||||
int Suffix = OpCode.Read(0x34, 0x1e);
|
case 0:
|
||||||
switch (Suffix)
|
case 0x4:
|
||||||
{
|
case 0x8:
|
||||||
case 0:
|
Suffix = TextureInstructionSuffix.LZ | TextureInstructionSuffix.AOFFI;
|
||||||
case 0x4:
|
break;
|
||||||
case 0x8:
|
case 0xc:
|
||||||
return TextureInstructionSuffix.LZ | TextureInstructionSuffix.AOFFI;
|
Suffix = TextureInstructionSuffix.LZ | TextureInstructionSuffix.MZ;
|
||||||
case 0xc:
|
break;
|
||||||
return TextureInstructionSuffix.LZ | TextureInstructionSuffix.MZ;
|
case 0xe:
|
||||||
case 0xe:
|
case 0x10:
|
||||||
case 0x10:
|
Suffix = TextureInstructionSuffix.LZ;
|
||||||
return TextureInstructionSuffix.LZ;
|
break;
|
||||||
case 0x2:
|
case 0x2:
|
||||||
case 0xa:
|
case 0xa:
|
||||||
return TextureInstructionSuffix.LL;
|
Suffix = TextureInstructionSuffix.LL;
|
||||||
case 0x18:
|
break;
|
||||||
return TextureInstructionSuffix.LL | TextureInstructionSuffix.AOFFI;
|
case 0x18:
|
||||||
default:
|
Suffix = TextureInstructionSuffix.LL | TextureInstructionSuffix.AOFFI;
|
||||||
throw new InvalidOperationException($"Invalid Suffix for TLDS instruction {Suffix}");
|
break;
|
||||||
}
|
default:
|
||||||
|
throw new InvalidOperationException($"Invalid Suffix for TLDS instruction {RawSuffix}");
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureType TextureType = TldsToTextureType(OpCode.Read(52, 0x1e));
|
TextureType TextureType = TldsToTextureType(OpCode.Read(52, 0x1e));
|
||||||
|
|
||||||
EmitTexs(Block, OpCode, ShaderIrInst.Txlf, TextureType, GetSuffix());
|
EmitTexs(Block, OpCode, ShaderIrInst.Txlf, TextureType, Suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Tld4(ShaderIrBlock Block, long OpCode, int Position)
|
public static void Tld4(ShaderIrBlock Block, long OpCode, int Position)
|
||||||
{
|
{
|
||||||
TextureInstructionSuffix GetSuffix()
|
TextureInstructionSuffix Suffix;
|
||||||
{
|
|
||||||
int RawSuffix = OpCode.Read(0x34, 0x38);
|
|
||||||
|
|
||||||
switch (RawSuffix)
|
int RawSuffix = OpCode.Read(0x34, 0x38);
|
||||||
{
|
|
||||||
case 0:
|
switch (RawSuffix)
|
||||||
return TextureInstructionSuffix.None;
|
{
|
||||||
case 0x4:
|
case 0:
|
||||||
return TextureInstructionSuffix.AOFFI;
|
Suffix = TextureInstructionSuffix.None;
|
||||||
case 0x8:
|
break;
|
||||||
return TextureInstructionSuffix.PTP;
|
case 0x4:
|
||||||
default:
|
Suffix = TextureInstructionSuffix.AOFFI;
|
||||||
throw new InvalidOperationException($"Invalid Suffix for TLD4 instruction {RawSuffix}");
|
break;
|
||||||
}
|
case 0x8:
|
||||||
|
Suffix = TextureInstructionSuffix.PTP;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new InvalidOperationException($"Invalid Suffix for TLD4 instruction {RawSuffix}");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsShadow = OpCode.Read(0x32);
|
bool IsShadow = OpCode.Read(0x32);
|
||||||
|
@ -477,8 +499,6 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
TextureType TextureType = TexToTextureType(OpCode.Read(28, 6), IsArray);
|
TextureType TextureType = TexToTextureType(OpCode.Read(28, 6), IsArray);
|
||||||
|
|
||||||
TextureInstructionSuffix Suffix = GetSuffix();
|
|
||||||
|
|
||||||
if (IsShadow)
|
if (IsShadow)
|
||||||
{
|
{
|
||||||
Suffix |= TextureInstructionSuffix.DC;
|
Suffix |= TextureInstructionSuffix.DC;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue