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