Fix support buffer declaration
This commit is contained in:
parent
075bba2c06
commit
d17472f2ec
1 changed files with 14 additions and 10 deletions
|
@ -139,22 +139,26 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
|
||||||
context.EnterScope();
|
context.EnterScope();
|
||||||
|
|
||||||
foreach (StructureField field in buffer.Type.Fields)
|
foreach (StructureField field in buffer.Type.Fields)
|
||||||
{
|
|
||||||
if (field.Type.HasFlag(AggregateType.Array) && field.ArrayLength > 0)
|
|
||||||
{
|
{
|
||||||
string typeName = GetVarTypeName(context, field.Type & ~AggregateType.Array);
|
string typeName = GetVarTypeName(context, field.Type & ~AggregateType.Array);
|
||||||
|
string arraySuffix = "";
|
||||||
|
|
||||||
context.AppendLine($"{typeName} {field.Name}[{field.ArrayLength}];");
|
if (field.Type.HasFlag(AggregateType.Array))
|
||||||
|
{
|
||||||
|
if (field.ArrayLength > 0)
|
||||||
|
{
|
||||||
|
arraySuffix = $"[{field.ArrayLength}]";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string typeName = GetVarTypeName(context, field.Type & ~AggregateType.Array);
|
|
||||||
|
|
||||||
// Probably UB, but this is the approach that MVK takes
|
// Probably UB, but this is the approach that MVK takes
|
||||||
context.AppendLine($"{typeName} {field.Name}[1];");
|
arraySuffix = "[1]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.AppendLine($"{typeName} {field.Name}{arraySuffix};");
|
||||||
|
}
|
||||||
|
|
||||||
context.LeaveScope(";");
|
context.LeaveScope(";");
|
||||||
context.AppendLine();
|
context.AppendLine();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue