Change how unsized arrays are indexed
This commit is contained in:
parent
feb68231b3
commit
6da40db9db
2 changed files with 3 additions and 10 deletions
|
@ -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];");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue