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