From f08d3a751786df7c74d6bee43152cee54da9042d Mon Sep 17 00:00:00 2001 From: Samuliak Date: Mon, 20 May 2024 18:38:08 +0200 Subject: [PATCH] support multiple render targets & fix: incorrect texture name --- src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs | 2 +- .../CodeGen/Msl/Instructions/InstGenMemory.cs | 6 ++++-- .../CodeGen/Msl/Instructions/IoMap.cs | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs index 4f6015ee7..657579a24 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs @@ -197,7 +197,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl { IoVariable.Position => "position", IoVariable.PointSize => "point_size", - IoVariable.FragmentOutputColor => "color", + IoVariable.FragmentOutputColor => $"color{ioDefinition.Location}", _ => $"{DefaultNames.OAttributePrefix}{ioDefinition.Location}" }; string suffix = ioDefinition.IoVariable switch diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs index 217c21816..44051a3ad 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs @@ -267,7 +267,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions return NumberFormatter.FormatInt(0); } - string textureName = "texture"; + string samplerName = GetSamplerName(context.Properties, texOp); + string textureName = $"tex_{samplerName}"; string texCall = textureName + "."; texCall += $"get_num_samples()"; @@ -278,7 +279,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions { AstTextureOperation texOp = (AstTextureOperation)operation; - string textureName = "texture"; + string samplerName = GetSamplerName(context.Properties, texOp); + string textureName = $"tex_{samplerName}"; string texCall = textureName + "."; if (texOp.Index == 3) diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/IoMap.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/IoMap.cs index 9ead6bc56..c836d9832 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/IoMap.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/IoMap.cs @@ -19,7 +19,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions IoVariable.BaseInstance => ("base_instance", AggregateType.S32), IoVariable.BaseVertex => ("base_vertex", AggregateType.S32), IoVariable.ClipDistance => ("clip_distance", AggregateType.Array | AggregateType.FP32), - IoVariable.FragmentOutputColor => ("out.color", AggregateType.Vector4 | AggregateType.FP32), + IoVariable.FragmentOutputColor => ($"out.color{location}", AggregateType.Vector4 | AggregateType.FP32), IoVariable.FragmentOutputDepth => ("depth", AggregateType.FP32), IoVariable.FrontFacing => ("front_facing", AggregateType.Bool), IoVariable.InstanceId => ("instance_id", AggregateType.S32),