summaryrefslogtreecommitdiff
path: root/source/slang/core.meta.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-09-28 18:07:40 -0700
committerGitHub <noreply@github.com>2023-09-28 18:07:40 -0700
commitb7d318f48db2cb83a41d665f1727ae93fc555124 (patch)
treed81d69cbba264cd059bbe67f29235226032c4793 /source/slang/core.meta.slang
parente7238942ea003e134b325fa65296df8e19368e90 (diff)
Support `constref` parameters passing. (#3249)
* Support `constref` parameters passing. * Fix. * Fix. * Add test and diagnostic on mix use of __constref and no_diff. * check for [constref] on differentiable member method. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/core.meta.slang')
-rw-r--r--source/slang/core.meta.slang9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang
index 43640eb41..87697076e 100644
--- a/source/slang/core.meta.slang
+++ b/source/slang/core.meta.slang
@@ -679,6 +679,12 @@ struct Ref
{};
__generic<T>
+__magic_type(ConstRefType)
+__intrinsic_type($(kIROp_ConstRefType))
+struct ConstRef
+{};
+
+__generic<T>
__magic_type(OptionalType)
__intrinsic_type($(kIROp_OptionalType))
struct Optional
@@ -2237,6 +2243,9 @@ attribute_syntax [mutating] : MutatingAttribute;
__attributeTarget(SetterDecl)
attribute_syntax [nonmutating] : NonmutatingAttribute;
+__attributeTarget(FunctionDeclBase)
+attribute_syntax [constref] : ConstRefAttribute;
+
/// Indicates that a function computes its result as a function of its arguments without loading/storing any memory or other state.
///
/// This is equivalent to the LLVM `readnone` function attribute.