Implement PointCoord and PointSize shader attributes (#353)
* Implement PointCoord and PointSize shader attributes * Address feedback
This commit is contained in:
parent
c393cdf8e3
commit
6e1a6c5b2b
2 changed files with 22 additions and 9 deletions
|
@ -6,6 +6,9 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
class GlslDecl
|
class GlslDecl
|
||||||
{
|
{
|
||||||
public const int LayerAttr = 0x064;
|
public const int LayerAttr = 0x064;
|
||||||
|
public const int PointSizeAttr = 0x06c;
|
||||||
|
public const int PointCoordAttrX = 0x2e0;
|
||||||
|
public const int PointCoordAttrY = 0x2e4;
|
||||||
public const int TessCoordAttrX = 0x2f0;
|
public const int TessCoordAttrX = 0x2f0;
|
||||||
public const int TessCoordAttrY = 0x2f4;
|
public const int TessCoordAttrY = 0x2f4;
|
||||||
public const int TessCoordAttrZ = 0x2f8;
|
public const int TessCoordAttrZ = 0x2f8;
|
||||||
|
@ -249,11 +252,14 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
case ShaderIrOperAbuf Abuf:
|
case ShaderIrOperAbuf Abuf:
|
||||||
{
|
{
|
||||||
//This is a built-in input variable.
|
//This is a built-in variable.
|
||||||
if (Abuf.Offs == VertexIdAttr ||
|
if (Abuf.Offs == LayerAttr ||
|
||||||
Abuf.Offs == InstanceIdAttr ||
|
Abuf.Offs == PointSizeAttr ||
|
||||||
Abuf.Offs == FaceAttr ||
|
Abuf.Offs == PointCoordAttrX ||
|
||||||
Abuf.Offs == LayerAttr)
|
Abuf.Offs == PointCoordAttrY ||
|
||||||
|
Abuf.Offs == VertexIdAttr ||
|
||||||
|
Abuf.Offs == InstanceIdAttr ||
|
||||||
|
Abuf.Offs == FaceAttr)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -345,4 +351,4 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
return Decls.ContainsKey(Index);
|
return Decls.ContainsKey(Index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -795,6 +795,9 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
{
|
{
|
||||||
switch (Abuf.Offs)
|
switch (Abuf.Offs)
|
||||||
{
|
{
|
||||||
|
case GlslDecl.PointCoordAttrX: return "gl_PointCoord.x";
|
||||||
|
case GlslDecl.PointCoordAttrY: return "gl_PointCoord.y";
|
||||||
|
|
||||||
//Note: It's a guess that Maxwell's face is 1 when gl_FrontFacing == true
|
//Note: It's a guess that Maxwell's face is 1 when gl_FrontFacing == true
|
||||||
case GlslDecl.FaceAttr: return "(gl_FrontFacing ? 1 : 0)";
|
case GlslDecl.FaceAttr: return "(gl_FrontFacing ? 1 : 0)";
|
||||||
}
|
}
|
||||||
|
@ -813,7 +816,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
if (!Decl.Attributes.TryGetValue(Index, out ShaderDeclInfo DeclInfo))
|
if (!Decl.Attributes.TryGetValue(Index, out ShaderDeclInfo DeclInfo))
|
||||||
{
|
{
|
||||||
//Handle special vec4 attributes here
|
//Handle special vec4 attributes here
|
||||||
//(for example, index 7 is aways gl_Position).
|
//(for example, index 7 is always gl_Position).
|
||||||
if (Index == GlslDecl.GlPositionVec4Index)
|
if (Index == GlslDecl.GlPositionVec4Index)
|
||||||
{
|
{
|
||||||
string Name =
|
string Name =
|
||||||
|
@ -822,6 +825,10 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
return Name + Swizzle;
|
return Name + Swizzle;
|
||||||
}
|
}
|
||||||
|
else if (Abuf.Offs == GlslDecl.PointSizeAttr)
|
||||||
|
{
|
||||||
|
return "gl_PointSize";
|
||||||
|
}
|
||||||
|
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
@ -1265,9 +1272,9 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
switch (Node)
|
switch (Node)
|
||||||
{
|
{
|
||||||
case ShaderIrOperAbuf Abuf:
|
case ShaderIrOperAbuf Abuf:
|
||||||
return Abuf.Offs == GlslDecl.LayerAttr ||
|
return Abuf.Offs == GlslDecl.LayerAttr ||
|
||||||
Abuf.Offs == GlslDecl.InstanceIdAttr ||
|
Abuf.Offs == GlslDecl.InstanceIdAttr ||
|
||||||
Abuf.Offs == GlslDecl.VertexIdAttr ||
|
Abuf.Offs == GlslDecl.VertexIdAttr ||
|
||||||
Abuf.Offs == GlslDecl.FaceAttr
|
Abuf.Offs == GlslDecl.FaceAttr
|
||||||
? OperType.I32
|
? OperType.I32
|
||||||
: OperType.F32;
|
: OperType.F32;
|
||||||
|
|
Loading…
Reference in a new issue