Vertex Input Attributes

This commit is contained in:
Isaac Marovitz 2023-08-04 23:51:24 -04:00 committed by Isaac Marovitz
parent f07327166c
commit bbc2ac2e9b
6 changed files with 46 additions and 16 deletions

View file

@ -3,7 +3,7 @@ using Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions;
using Ryujinx.Graphics.Shader.StructuredIr;
using Ryujinx.Graphics.Shader.Translation;
using System;
using System.Linq;
using static Ryujinx.Graphics.Shader.CodeGen.Msl.TypeConversion;
namespace Ryujinx.Graphics.Shader.CodeGen.Msl
@ -77,6 +77,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
string funcKeyword = "inline";
string funcName = null;
if (isMainFunc)
{
if (stage == ShaderStage.Vertex)
@ -89,6 +90,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
funcKeyword = "fragment";
funcName = "fragmentMain";
}
if (context.Config.UsedInputAttributes != 0)
{
args = args.Prepend("VertexIn in [[stage_in]]").ToArray();
}
}
return $"{funcKeyword} {Declarations.GetVarTypeName(context, function.ReturnType)} {funcName ?? function.Name}({string.Join(", ", args)})";