diff options
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs')
-rw-r--r-- | Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs index 240fd6b1..51b70601 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs @@ -95,9 +95,28 @@ namespace Ryujinx.Graphics.Shader.Instructions if (context.Config.Stage != ShaderStage.Compute && context.Config.Stage != ShaderStage.Fragment) { Operand primitiveId = Attribute(AttributeConsts.PrimitiveId); - Operand patchVerticesIn = Attribute(AttributeConsts.PatchVerticesIn); - - patchVerticesIn = context.ShiftLeft(patchVerticesIn, Const(16)); + Operand patchVerticesIn; + + if (context.Config.Stage == ShaderStage.TessellationEvaluation) + { + patchVerticesIn = context.ShiftLeft(Attribute(AttributeConsts.PatchVerticesIn), Const(16)); + } + else + { + InputTopology inputTopology = context.Config.GpuAccessor.QueryPrimitiveTopology(); + + int inputVertices = inputTopology switch + { + InputTopology.Points => 1, + InputTopology.Lines or + InputTopology.LinesAdjacency => 2, + InputTopology.Triangles or + InputTopology.TrianglesAdjacency => 3, + _ => 1 + }; + + patchVerticesIn = Const(inputVertices << 16); + } src = context.BitwiseOr(primitiveId, patchVerticesIn); } |