summaryrefslogtreecommitdiffstats
path: root/source/slang/core.meta.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-08-23 21:45:59 -0700
committerGitHub <noreply@github.com>2024-08-23 21:45:59 -0700
commitb2ca2d5a4efeae807d3c3f48f60235e47413b559 (patch)
tree643d2bab5776e5f8f7cfa722975af9e826d77c9d /source/slang/core.meta.slang
parente4088cd602bd4d5a72fea67a787b1319acfc044d (diff)
Make variadic generics work with interfaces and forward autodiff. (#4905)
Diffstat (limited to 'source/slang/core.meta.slang')
-rw-r--r--source/slang/core.meta.slang24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang
index 84e1b8168..0b57993ef 100644
--- a/source/slang/core.meta.slang
+++ b/source/slang/core.meta.slang
@@ -953,6 +953,30 @@ extension Tuple<T> : IComparable
}
}
+interface IMutatingFunc<TR, each TP>
+{
+ [mutating]
+ TR __call(expand each TP p);
+}
+
+interface IFunc<TR, each TP> : IMutatingFunc<TR, expand each TP>
+{
+ TR __call(expand each TP p);
+}
+
+interface IDifferentiableMutatingFunc<TR : IDifferentiable, each TP : IDifferentiable> : IMutatingFunc<TR, expand each TP>
+{
+ [Differentiable]
+ [mutating]
+ TR __call(expand each TP p);
+}
+
+interface IDifferentiableFunc<TR : IDifferentiable, each TP : IDifferentiable> : IFunc<TR, expand each TP>, IDifferentiableMutatingFunc<TR, expand each TP>
+{
+ [Differentiable]
+ TR __call(expand each TP p);
+}
+
__generic<T>
__magic_type(NativeRefType)
__intrinsic_type($(kIROp_NativePtrType))