2020-10-25 17:00:44 -03:00
|
|
|
using Ryujinx.Graphics.Shader.IntermediateRepresentation;
|
|
|
|
|
using Ryujinx.Graphics.Shader.StructuredIr;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
|
|
|
|
using static Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions.InstGenHelper;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
|
|
|
|
|
{
|
|
|
|
|
static class InstGenCall
|
|
|
|
|
{
|
|
|
|
|
public static string Call(CodeGenContext context, AstOperation operation)
|
|
|
|
|
{
|
|
|
|
|
AstOperand funcId = (AstOperand)operation.GetSource(0);
|
|
|
|
|
|
|
|
|
|
Debug.Assert(funcId.Type == OperandType.Constant);
|
|
|
|
|
|
2025-01-25 14:07:59 -06:00
|
|
|
StructuredFunction function = context.GetFunction(funcId.Value);
|
2020-10-25 17:00:44 -03:00
|
|
|
|
|
|
|
|
string[] args = new string[operation.SourcesCount - 1];
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < args.Length; i++)
|
|
|
|
|
{
|
2024-04-07 18:25:55 -03:00
|
|
|
args[i] = GetSourceExpr(context, operation.GetSource(i + 1), function.GetArgumentType(i));
|
2020-10-25 17:00:44 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $"{function.Name}({string.Join(", ", args)})";
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-28 08:59:13 +02:00
|
|
|
}
|