summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-08-10 17:30:05 -0700
committerGitHub <noreply@github.com>2023-08-10 17:30:05 -0700
commit37223160be2543861bb795dc2d2d4cb6ac9843cb (patch)
treef03f89295e1dbc87d8d0441d6a25dbd425e9df59 /source
parent7691128c381c3af44db8589fce044b51b8eece13 (diff)
Add scalar version of `distance`. (#3096)
Diffstat (limited to 'source')
-rw-r--r--source/slang/hlsl.meta.slang7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index 434a8245a..9de14ad96 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -1781,6 +1781,13 @@ T distance(vector<T, N> x, vector<T, N> y)
return length(x - y);
}
+__generic<T : __BuiltinFloatingPointType>
+[__readNone]
+T distance(T x, T y)
+{
+ return length(x - y);
+}
+
// Vector dot product
__generic<T : __BuiltinFloatingPointType, let N : int>