Change how unsized arrays are indexed

This commit is contained in:
Isaac Marovitz 2024-06-21 13:26:44 +01:00
parent feb68231b3
commit 6da40db9db
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1
2 changed files with 3 additions and 10 deletions

View file

@ -150,7 +150,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
{
string typeName = GetVarTypeName(context, field.Type & ~AggregateType.Array);
context.AppendLine($"{typeName} {field.Name};");
// Probably UB, but this is the approach that MVK takes
context.AppendLine($"{typeName} {field.Name}[1];");
}
}

View file

@ -47,15 +47,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
StructureField field = buffer.Type.Fields[fieldIndex.Value];
varName = buffer.Name;
if ((field.Type & AggregateType.Array) != 0 && field.ArrayLength == 0)
{
// Unsized array, the buffer is indexed instead of the field
fieldName = "." + field.Name;
}
else
{
varName += "->" + field.Name;
}
varName += "->" + field.Name;
varType = field.Type;
break;