From d2e9f1c7a9629dba64d864d6c3e6ab1032529315 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Fri, 28 Jul 2023 00:29:05 -0400 Subject: [PATCH] IoMap --- .../CodeGen/Msl/Instructions/IoMap.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/IoMap.cs diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/IoMap.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/IoMap.cs new file mode 100644 index 000000000..261a0e572 --- /dev/null +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/IoMap.cs @@ -0,0 +1,29 @@ +using Ryujinx.Graphics.Shader.IntermediateRepresentation; +using Ryujinx.Graphics.Shader.Translation; + +namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions +{ + static class IoMap + { + public static (string, AggregateType) GetMSLBuiltIn(IoVariable ioVariable) + { + return ioVariable switch + { + IoVariable.BaseInstance => ("base_instance", AggregateType.S32), + IoVariable.BaseVertex => ("base_vertex", AggregateType.S32), + IoVariable.ClipDistance => ("clip_distance", AggregateType.Array | AggregateType.FP32), + IoVariable.FragmentOutputColor => ("color", AggregateType.Vector2 | AggregateType.Vector3 | AggregateType.Vector4), + IoVariable.FragmentOutputDepth => ("depth", AggregateType.FP32), + IoVariable.FrontFacing => ("front_facing", AggregateType.Bool), + IoVariable.InstanceId => ("instance_id", AggregateType.S32), + IoVariable.PointCoord => ("point_coord", AggregateType.Vector2), + IoVariable.PointSize => ("point_size", AggregateType.FP32), + IoVariable.Position => ("position", AggregateType.Vector4), + IoVariable.PrimitiveId => ("primitive_id", AggregateType.S32), + IoVariable.VertexId => ("vertex_id", AggregateType.S32), + IoVariable.ViewportIndex => ("viewport_array_index", AggregateType.S32), + _ => (null, AggregateType.Invalid), + }; + } + } +}