From 113e721cce351ea22da992a59e0808549cae8962 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Tue, 25 Jun 2024 14:51:54 +0100 Subject: [PATCH] Fix fragment point_coord in --- src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs | 7 ++++--- .../CodeGen/Msl/Instructions/IoMap.cs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs index 59cc5c56b..b15b482db 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs @@ -294,6 +294,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl // TODO: check if it's needed context.AppendLine("float4 position [[position, invariant]];"); context.AppendLine("bool front_facing [[front_facing]];"); + context.AppendLine("float2 point_coord [[point_coord]];"); } foreach (var ioDefinition in inputs.OrderBy(x => x.Location)) @@ -304,7 +305,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl IoVariable.GlobalId => "uint3", IoVariable.VertexId => "uint", IoVariable.VertexIndex => "uint", - IoVariable.PointCoord => "float2", + // IoVariable.PointCoord => "float2", _ => GetVarTypeName(context.Definitions.GetUserDefinedType(ioDefinition.Location, isOutput: false)) }; string name = ioDefinition.IoVariable switch @@ -313,7 +314,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl IoVariable.GlobalId => "global_id", IoVariable.VertexId => "vertex_id", IoVariable.VertexIndex => "vertex_index", - IoVariable.PointCoord => "point_coord", + // IoVariable.PointCoord => "point_coord", _ => $"{Defaults.IAttributePrefix}{ioDefinition.Location}" }; string suffix = ioDefinition.IoVariable switch @@ -323,7 +324,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl IoVariable.VertexId => "[[vertex_id]]", // TODO: Avoid potential redeclaration IoVariable.VertexIndex => "[[vertex_id]]", - IoVariable.PointCoord => "[[point_coord]]", + // IoVariable.PointCoord => "[[point_coord]]", IoVariable.UserDefined => context.Definitions.Stage == ShaderStage.Fragment ? $"[[user(loc{ioDefinition.Location})]]" : $"[[attribute({ioDefinition.Location})]]", _ => "" }; diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/IoMap.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/IoMap.cs index bb0f7f010..5db42bbef 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/IoMap.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/IoMap.cs @@ -28,7 +28,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions IoVariable.InstanceId => ("instance_id", AggregateType.U32), IoVariable.InstanceIndex => ("instance_index", AggregateType.U32), IoVariable.InvocationId => ("INVOCATION_ID", AggregateType.S32), - IoVariable.PointCoord => ("point_coord", AggregateType.Vector2 | AggregateType.FP32), + IoVariable.PointCoord => ("in.point_coord", AggregateType.Vector2 | AggregateType.FP32), IoVariable.PointSize => ("out.point_size", AggregateType.FP32), IoVariable.Position => ("out.position", AggregateType.Vector4 | AggregateType.FP32), IoVariable.PrimitiveId => ("primitive_id", AggregateType.S32),