aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2018-07-03 20:06:13 -0300
committergdkchan <gab.dark.100@gmail.com>2018-07-03 20:06:13 -0300
commit9cbf908cf5b7796fb459d74f99b2ebfcd3a4d648 (patch)
treece3848b90c7ae348576d4a9df88cce4dc86d5d3d /Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs
parent741773910d61a75bd5466265e5dd825d55a98e7c (diff)
Add FaceAttr in GLSL, unmanaged case in EmitTex and ConstantColorG80 blend factor (#207)
* Add FaceAttr (0x3fc) input attribute in GLSL * Implement unmanaged case in EmitTex * Add ConstantColor for 0xC001 (G80) from PR #145
Diffstat (limited to 'Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs')
-rw-r--r--Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs39
1 files changed, 27 insertions, 12 deletions
diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs
index c50f0144..083b0c63 100644
--- a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs
+++ b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeMem.cs
@@ -8,6 +8,29 @@ namespace Ryujinx.Graphics.Gal.Shader
{
private const int TempRegStart = 0x100;
+ private const int ____ = 0x0;
+ private const int R___ = 0x1;
+ private const int _G__ = 0x2;
+ private const int RG__ = 0x3;
+ private const int __B_ = 0x4;
+ private const int RGB_ = 0x7;
+ private const int ___A = 0x8;
+ private const int R__A = 0x9;
+ private const int _G_A = 0xa;
+ private const int RG_A = 0xb;
+ private const int __BA = 0xc;
+ private const int R_BA = 0xd;
+ private const int _GBA = 0xe;
+ private const int RGBA = 0xf;
+
+ private static int[,] MaskLut = new int[,]
+ {
+ { ____, ____, ____, ____, ____, ____, ____, ____ },
+ { R___, _G__, __B_, ___A, RG__, ____, ____, ____ },
+ { R___, _G__, __B_, ___A, RG__, R__A, _G_A, __BA },
+ { RGB_, RG_A, R_BA, _GBA, RGBA, ____, ____, ____ }
+ };
+
public static void Ld_A(ShaderIrBlock Block, long OpCode)
{
ShaderIrNode[] Opers = GetOperAbuf20(OpCode);
@@ -167,20 +190,12 @@ namespace Ryujinx.Graphics.Gal.Shader
ShaderIrNode OperB = GetOperGpr20 (OpCode);
ShaderIrNode OperC = GetOperImm13_36(OpCode);
- bool TwoDests = GetOperGpr28(OpCode).Index != ShaderIrOperGpr.ZRIndex;
+ int LutIndex;
- int ChMask;
+ LutIndex = GetOperGpr0(OpCode).Index != ShaderIrOperGpr.ZRIndex ? 1 : 0;
+ LutIndex |= GetOperGpr28(OpCode).Index != ShaderIrOperGpr.ZRIndex ? 2 : 0;
- switch ((OpCode >> 50) & 7)
- {
- case 0: ChMask = TwoDests ? 0x7 : 0x1; break;
- case 1: ChMask = TwoDests ? 0xb : 0x2; break;
- case 2: ChMask = TwoDests ? 0xd : 0x4; break;
- case 3: ChMask = TwoDests ? 0xe : 0x8; break;
- case 4: ChMask = TwoDests ? 0xf : 0x3; break;
-
- default: throw new InvalidOperationException();
- }
+ int ChMask = MaskLut[LutIndex, (OpCode >> 50) & 7];
for (int Ch = 0; Ch < 4; Ch++)
{