Fix IoMap variable names

Output struct

Lazy Vertex IO

Output fixes

Fix output struct definition

MSL Binding Model description

Might need tweaks/adjustments

Cleanup

Typo + Format
This commit is contained in:
Isaac Marovitz 2023-10-09 11:33:28 -04:00 committed by Isaac Marovitz
parent d5758cb310
commit 98e2ab5a49
4 changed files with 90 additions and 21 deletions

View file

@ -70,6 +70,10 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
{
return $"{op} {GetSourceExpr(context, operation.GetSource(0), context.CurrentFunction.ReturnType)}";
}
else if (inst == Instruction.Return && context.Definitions.Stage == ShaderStage.Vertex)
{
return $"{op} out";
}
int arity = (int)(info.Type & InstType.ArityMask);

View file

@ -25,7 +25,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
IoVariable.InstanceId => ("instance_id", AggregateType.S32),
IoVariable.PointCoord => ("point_coord", AggregateType.Vector2),
IoVariable.PointSize => ("point_size", AggregateType.FP32),
IoVariable.Position => ("position", AggregateType.Vector4 | AggregateType.FP32),
IoVariable.Position => ("out.position", AggregateType.Vector4 | AggregateType.FP32),
IoVariable.PrimitiveId => ("primitive_id", AggregateType.S32),
IoVariable.UserDefined => GetUserDefinedVariableName(definitions, location, component, isOutput, isPerPatch),
IoVariable.VertexId => ("vertex_id", AggregateType.S32),
@ -52,21 +52,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
name += "_" + "xyzw"[component & 3];
}
string prefix = "";
switch (definitions.Stage)
{
case ShaderStage.Vertex:
prefix = "Vertex";
break;
case ShaderStage.Fragment:
prefix = "Fragment";
break;
case ShaderStage.Compute:
prefix = "Compute";
break;
}
prefix += isOutput ? "Out" : "In";
string prefix = isOutput ? "out" : "in";
return (prefix + "." + name, definitions.GetUserDefinedType(location, isOutput));
}