Fix fragment shader bindings

This commit is contained in:
Isaac Marovitz 2024-03-19 21:04:31 -04:00
parent 8fd4270012
commit cc8bc3f921
No known key found for this signature in database
GPG Key ID: 97250B2B09A132E1
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)
{