Add FaceAttr (0x3fc) input attribute in GLSL

This commit is contained in:
ReinUsesLisp 2018-06-30 14:13:12 -03:00
commit 88aa78be76
2 changed files with 13 additions and 2 deletions

View file

@ -9,6 +9,7 @@ namespace Ryujinx.Graphics.Gal.Shader
public const int TessCoordAttrZ = 0x2f8; public const int TessCoordAttrZ = 0x2f8;
public const int InstanceIdAttr = 0x2f8; public const int InstanceIdAttr = 0x2f8;
public const int VertexIdAttr = 0x2fc; public const int VertexIdAttr = 0x2fc;
public const int FaceAttr = 0x3fc;
public const int GlPositionWAttr = 0x7c; public const int GlPositionWAttr = 0x7c;
public const int MaxUboSize = 1024; public const int MaxUboSize = 1024;
@ -208,7 +209,8 @@ namespace Ryujinx.Graphics.Gal.Shader
{ {
//This is a built-in input variable. //This is a built-in input variable.
if (Abuf.Offs == VertexIdAttr || if (Abuf.Offs == VertexIdAttr ||
Abuf.Offs == InstanceIdAttr) Abuf.Offs == InstanceIdAttr ||
Abuf.Offs == FaceAttr)
{ {
break; break;
} }

View file

@ -658,6 +658,14 @@ namespace Ryujinx.Graphics.Gal.Shader
case GlslDecl.TessCoordAttrZ: return "gl_TessCoord.z"; 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); return GetAttrTempName(Abuf);
} }
@ -1084,7 +1092,8 @@ namespace Ryujinx.Graphics.Gal.Shader
{ {
case ShaderIrOperAbuf Abuf: case ShaderIrOperAbuf Abuf:
return Abuf.Offs == GlslDecl.VertexIdAttr || return Abuf.Offs == GlslDecl.VertexIdAttr ||
Abuf.Offs == GlslDecl.InstanceIdAttr Abuf.Offs == GlslDecl.InstanceIdAttr ||
Abuf.Offs == GlslDecl.FaceAttr
? OperType.I32 ? OperType.I32
: OperType.F32; : OperType.F32;