aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenCall.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenCall.cs')
-rw-r--r--src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenCall.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenCall.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenCall.cs
new file mode 100644
index 00000000..2df6960d
--- /dev/null
+++ b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenCall.cs
@@ -0,0 +1,29 @@
+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);
+
+ var function = context.GetFunction(funcId.Value);
+
+ string[] args = new string[operation.SourcesCount - 1];
+
+ for (int i = 0; i < args.Length; i++)
+ {
+ args[i] = GetSoureExpr(context, operation.GetSource(i + 1), function.GetArgumentType(i));
+ }
+
+ return $"{function.Name}({string.Join(", ", args)})";
+ }
+ }
+} \ No newline at end of file