Fix stage input struct names

This commit is contained in:
Isaac Marovitz 2023-08-15 23:10:17 +01:00 committed by Isaac Marovitz
parent cb971781d8
commit e2ded6bc4f
2 changed files with 32 additions and 2 deletions

View file

@ -77,7 +77,22 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
{
if (inputs.Any())
{
context.AppendLine("struct VertexIn");
string prefix = "";
switch (context.Definitions.Stage)
{
case ShaderStage.Vertex:
prefix = "Vertex";
break;
case ShaderStage.Fragment:
prefix = "Fragment";
break;
case ShaderStage.Compute:
prefix = "Compute";
break;
}
context.AppendLine($"struct {prefix}In");
context.EnterScope();
foreach (var ioDefinition in inputs.OrderBy(x => x.Location))

View file

@ -90,10 +90,25 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
funcKeyword = "fragment";
funcName = "fragmentMain";
}
else if (stage == ShaderStage.Compute)
{
// TODO: Compute main
}
if (context.AttributeUsage.UsedInputAttributes != 0)
{
args = args.Prepend("VertexIn in [[stage_in]]").ToArray();
if (stage == ShaderStage.Vertex)
{
args = args.Prepend("VertexIn in [[stage_in]]").ToArray();
}
else if (stage == ShaderStage.Fragment)
{
args = args.Prepend("FragmentIn in [[stage_in]]").ToArray();
}
else if (stage == ShaderStage.Compute)
{
// TODO: Compute input
}
}
}