1
- // ===--- hlsl_compat_overloads.h - Additional HLSL overload definitions for intrinsics --===//
1
+ // ===--- hlsl_compat_overloads.h - Additional HLSL overload definitions for
2
+ // intrinsics --===//
2
3
//
3
4
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
5
// See https://llvm.org/LICENSE.txt for license information.
@@ -20,26 +21,40 @@ namespace hlsl {
20
21
// clamp builtins overloads
21
22
// ===----------------------------------------------------------------------===//
22
23
23
- template <typename T, typename R, typename U, uint N>
24
- constexpr __detail::enable_if_t <__detail::is_arithmetic<U>::Value, vector<T,N>> clamp (vector<T,N> p0, vector<R,N> p1, U p2) {
25
- return __builtin_hlsl_elementwise_clamp (p0, (vector<T,N>)p1, (vector<T,N>)p2);
24
+ template <typename T, typename R, typename U, uint N>
25
+ constexpr __detail::enable_if_t <__detail::is_arithmetic<U>::Value, vector<T, N>>
26
+ clamp (vector<T, N> p0, vector<R, N> p1, U p2) {
27
+ return __builtin_hlsl_elementwise_clamp (p0, (vector<T, N>)p1,
28
+ (vector<T, N>)p2);
26
29
}
27
- template <typename T, typename R, typename U, uint N>
28
- constexpr __detail::enable_if_t <__detail::is_arithmetic<U>::Value, vector<T,N>> clamp (vector<T,N> p0, U p1, vector<R,N> p2) {
29
- return __builtin_hlsl_elementwise_clamp (p0, (vector<T,N>)p1, (vector<T,N>)p2);
30
+ template <typename T, typename R, typename U, uint N>
31
+ constexpr __detail::enable_if_t <__detail::is_arithmetic<U>::Value, vector<T, N>>
32
+ clamp (vector<T, N> p0, U p1, vector<R, N> p2) {
33
+ return __builtin_hlsl_elementwise_clamp (p0, (vector<T, N>)p1,
34
+ (vector<T, N>)p2);
30
35
}
31
- template <typename T, typename U, typename V, uint N>
32
- constexpr __detail::enable_if_t <__detail::is_arithmetic<U>::Value && __detail::is_arithmetic<V>::Value, vector<T,N>> clamp (vector<T,N> p0, U p1, V p2) {
33
- return __builtin_hlsl_elementwise_clamp (p0, (vector<T,N>)p1, (vector<T,N>)p2);
36
+ template <typename T, typename U, typename V, uint N>
37
+ constexpr __detail::enable_if_t <__detail::is_arithmetic<U>::Value &&
38
+ __detail::is_arithmetic<V>::Value,
39
+ vector<T, N>>
40
+ clamp (vector<T, N> p0, U p1, V p2) {
41
+ return __builtin_hlsl_elementwise_clamp (p0, (vector<T, N>)p1,
42
+ (vector<T, N>)p2);
34
43
}
35
- template <typename T, typename R, typename S, uint N>
36
- constexpr vector<T,N> clamp (vector<T,N> p0, vector<R,N> p1, vector<S,N> p2) {
37
- return __builtin_hlsl_elementwise_clamp (p0, (vector<T,N>)p1, (vector<T,N>)p2);
44
+ template <typename T, typename R, typename S, uint N>
45
+ constexpr vector<T, N> clamp (vector<T, N> p0, vector<R, N> p1,
46
+ vector<S, N> p2) {
47
+ return __builtin_hlsl_elementwise_clamp (p0, (vector<T, N>)p1,
48
+ (vector<T, N>)p2);
38
49
}
39
- template <typename U, typename V, typename W>
40
- constexpr __detail::enable_if_t <__detail::is_arithmetic<U>::Value && __detail::is_arithmetic<V>::Value && __detail::is_arithmetic<W>::Value, U> clamp (U p0, V p1, W p2) {
41
- return __builtin_hlsl_elementwise_clamp (p0, (U) p1, (U) p2);
50
+ template <typename U, typename V, typename W>
51
+ constexpr __detail::enable_if_t <__detail::is_arithmetic<U>::Value &&
52
+ __detail::is_arithmetic<V>::Value &&
53
+ __detail::is_arithmetic<W>::Value,
54
+ U>
55
+ clamp (U p0, V p1, W p2) {
56
+ return __builtin_hlsl_elementwise_clamp (p0, (U)p1, (U)p2);
42
57
}
43
-
58
+
44
59
} // namespace hlsl
45
60
#endif // _HLSL_COMPAT_OVERLOADS_H_
0 commit comments