From 88aa78be7678c156196e75aff9578b62aff3757c Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sat, 30 Jun 2018 14:13:12 -0300 Subject: [PATCH] Add FaceAttr (0x3fc) input attribute in GLSL --- Ryujinx.Graphics/Gal/Shader/GlslDecl.cs | 4 +++- Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Ryujinx.Graphics/Gal/Shader/GlslDecl.cs b/Ryujinx.Graphics/Gal/Shader/GlslDecl.cs index 867f901604..d3284f9f55 100644 --- a/Ryujinx.Graphics/Gal/Shader/GlslDecl.cs +++ b/Ryujinx.Graphics/Gal/Shader/GlslDecl.cs @@ -9,6 +9,7 @@ namespace Ryujinx.Graphics.Gal.Shader public const int TessCoordAttrZ = 0x2f8; public const int InstanceIdAttr = 0x2f8; public const int VertexIdAttr = 0x2fc; + public const int FaceAttr = 0x3fc; public const int GlPositionWAttr = 0x7c; public const int MaxUboSize = 1024; @@ -208,7 +209,8 @@ namespace Ryujinx.Graphics.Gal.Shader { //This is a built-in input variable. if (Abuf.Offs == VertexIdAttr || - Abuf.Offs == InstanceIdAttr) + Abuf.Offs == InstanceIdAttr || + Abuf.Offs == FaceAttr) { break; } diff --git a/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs b/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs index 87d448689b..f3075a504e 100644 --- a/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs +++ b/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs @@ -658,6 +658,14 @@ namespace Ryujinx.Graphics.Gal.Shader case GlslDecl.TessCoordAttrZ: return "gl_TessCoord.z"; } } + else if (Decl.ShaderType == GalShaderType.Fragment) + { + switch (Abuf.Offs) + { + //Note: It's a guess that Maxwell's face is 1 when gl_FrontFacing == true + case GlslDecl.FaceAttr: return "(gl_FrontFacing ? 1 : 0)"; + } + } return GetAttrTempName(Abuf); } @@ -1084,7 +1092,8 @@ namespace Ryujinx.Graphics.Gal.Shader { case ShaderIrOperAbuf Abuf: return Abuf.Offs == GlslDecl.VertexIdAttr || - Abuf.Offs == GlslDecl.InstanceIdAttr + Abuf.Offs == GlslDecl.InstanceIdAttr || + Abuf.Offs == GlslDecl.FaceAttr ? OperType.I32 : OperType.F32;