Fix fragment shader bindings

This commit is contained in:
Isaac Marovitz 2024-03-19 21:04:31 -04:00 committed by Isaac Marovitz
parent 8dca53685a
commit 35cc208435
2 changed files with 9 additions and 3 deletions

View file

@ -123,7 +123,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
context.AppendLine($"struct VertexIn");
break;
case ShaderStage.Fragment:
context.AppendLine($"struct VertexOut");
context.AppendLine($"struct FragmentIn");
break;
case ShaderStage.Compute:
context.AppendLine($"struct ComputeIn");
@ -136,7 +136,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
{
string type = GetVarTypeName(context, context.Definitions.GetUserDefinedType(ioDefinition.Location, isOutput: false));
string name = $"{DefaultNames.IAttributePrefix}{ioDefinition.Location}";
string suffix = context.Definitions.Stage == ShaderStage.Vertex ? $" [[attribute({ioDefinition.Location})]]" : "";
string suffix = context.Definitions.Stage switch
{
ShaderStage.Vertex => $" [[attribute({ioDefinition.Location})]]",
ShaderStage.Fragment => $" [[user(loc{ioDefinition.Location})]]",
_ => ""
};
context.AppendLine($"{type} {name}{suffix};");
}
@ -192,6 +197,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
{
IoVariable.Position => " [[position]]",
IoVariable.PointSize => " [[point_size]]",
IoVariable.UserDefined => $" [[user(loc{ioDefinition.Location})]]",
IoVariable.FragmentOutputColor => $" [[color({ioDefinition.Location})]]",
_ => ""
};

View file

@ -106,7 +106,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
}
else if (stage == ShaderStage.Fragment)
{
args = args.Prepend("VertexOut in").ToArray();
args = args.Prepend("VertexOut in [[stage_in]]").ToArray();
}
else if (stage == ShaderStage.Compute)
{