2023-08-15 13:17:00 +00:00
|
|
|
using Ryujinx.Graphics.Shader.StructuredIr;
|
|
|
|
|
|
|
|
using static Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions.InstGenHelper;
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
|
|
|
{
|
|
|
|
static class InstGenCall
|
|
|
|
{
|
|
|
|
public static string Call(CodeGenContext context, AstOperation operation)
|
|
|
|
{
|
|
|
|
AstOperand funcId = (AstOperand)operation.GetSource(0);
|
|
|
|
|
|
|
|
var functon = context.GetFunction(funcId.Value);
|
|
|
|
|
2024-05-29 15:21:59 +00:00
|
|
|
int argCount = operation.SourcesCount - 1;
|
|
|
|
string[] args = new string[argCount + CodeGenContext.additionalArgCount];
|
2023-08-15 13:17:00 +00:00
|
|
|
|
2024-05-29 15:21:59 +00:00
|
|
|
// Additional arguments
|
|
|
|
args[0] = "support_buffer";
|
|
|
|
|
|
|
|
int argIndex = CodeGenContext.additionalArgCount;
|
|
|
|
for (int i = 0; i < argCount; i++)
|
2023-08-15 13:17:00 +00:00
|
|
|
{
|
2024-05-29 15:21:59 +00:00
|
|
|
args[argIndex++] = GetSourceExpr(context, operation.GetSource(i + 1), functon.GetArgumentType(i));
|
2023-08-15 13:17:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $"{functon.Name}({string.Join(", ", args)})";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|