2022-12-29 07:09:34 -08:00
|
|
|
using Ryujinx.Graphics.Shader.Translation;
|
2020-10-25 13:00:44 -07:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Shader.StructuredIr
|
|
|
|
{
|
|
|
|
class StructuredFunction
|
|
|
|
{
|
|
|
|
public AstBlock MainBlock { get; }
|
|
|
|
|
|
|
|
public string Name { get; }
|
|
|
|
|
2022-12-29 07:09:34 -08:00
|
|
|
public AggregateType ReturnType { get; }
|
2020-10-25 13:00:44 -07:00
|
|
|
|
2022-12-29 07:09:34 -08:00
|
|
|
public AggregateType[] InArguments { get; }
|
|
|
|
public AggregateType[] OutArguments { get; }
|
2020-10-25 13:00:44 -07:00
|
|
|
|
|
|
|
public HashSet<AstOperand> Locals { get; }
|
|
|
|
|
|
|
|
public StructuredFunction(
|
|
|
|
AstBlock mainBlock,
|
|
|
|
string name,
|
2022-12-29 07:09:34 -08:00
|
|
|
AggregateType returnType,
|
|
|
|
AggregateType[] inArguments,
|
|
|
|
AggregateType[] outArguments)
|
2020-10-25 13:00:44 -07:00
|
|
|
{
|
|
|
|
MainBlock = mainBlock;
|
|
|
|
Name = name;
|
|
|
|
ReturnType = returnType;
|
|
|
|
InArguments = inArguments;
|
|
|
|
OutArguments = outArguments;
|
|
|
|
|
|
|
|
Locals = new HashSet<AstOperand>();
|
|
|
|
}
|
|
|
|
|
2022-12-29 07:09:34 -08:00
|
|
|
public AggregateType GetArgumentType(int index)
|
2020-10-25 13:00:44 -07:00
|
|
|
{
|
|
|
|
return index >= InArguments.Length
|
|
|
|
? OutArguments[index - InArguments.Length]
|
|
|
|
: InArguments[index];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|