diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/MslGenerator.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/MslGenerator.cs index 5e6f344fc..8fa9df0ca 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/MslGenerator.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/MslGenerator.cs @@ -24,13 +24,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl if (info.Functions.Count != 0) { - for (int i = 1; i < info.Functions.Count; i++) - { - context.AppendLine($"{GetFunctionSignature(context, info.Functions[i], parameters.Definitions.Stage)};"); - } - - context.AppendLine(); - for (int i = 1; i < info.Functions.Count; i++) { PrintFunction(context, info.Functions[i], parameters.Definitions.Stage); @@ -58,7 +51,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl context.LeaveScope(); } - private static string GetFunctionSignature(CodeGenContext context, StructuredFunction function, ShaderStage stage, bool isMainFunc = false) + private static string GetFunctionSignature( + CodeGenContext context, + StructuredFunction function, + ShaderStage stage, + bool isMainFunc = false) { string[] args = new string[function.InArguments.Length + function.OutArguments.Length]; @@ -115,6 +112,16 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl args = args.Prepend("KernelIn in [[stage_in]]").ToArray(); } } + + foreach (var constantBuffer in context.Properties.ConstantBuffers.Values) + { + args = args.Append($"constant float4 *{constantBuffer.Name} [[buffer({constantBuffer.Binding})]]").ToArray(); + } + + foreach (var storageBuffers in context.Properties.StorageBuffers.Values) + { + args = args.Append($"device float4 *{storageBuffers.Name} [[buffer({storageBuffers.Binding})]]").ToArray(); + } } return $"{funcKeyword} {returnType} {funcName ?? function.Name}({string.Join(", ", args)})";