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);
|
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];
|
StructureField field = buffer.Type.Fields[fieldIndex.Value];
|
||||||
varName = buffer.Name;
|
varName = buffer.Name;
|
||||||
if ((field.Type & AggregateType.Array) != 0 && field.ArrayLength == 0)
|
varName += "->" + field.Name;
|
||||||
{
|
|
||||||
// Unsized array, the buffer is indexed instead of the field
|
|
||||||
fieldName = "." + field.Name;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
varName += "->" + field.Name;
|
|
||||||
}
|
|
||||||
varType = field.Type;
|
varType = field.Type;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue