File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,20 @@ template <typename T> struct is_arithmetic {
45
45
static const bool Value = __is_arithmetic(T);
46
46
};
47
47
48
+ template <typename T, int N>
49
+ constexpr enable_if_t <is_same<float , T>::value || is_same<half, T>::value, T>
50
+ fmod_vec_impl (vector<T, N> X, vector<T, N> Y) {
51
+ #if !defined(__DirectX__)
52
+ return __builtin_elementwise_fmod (X, Y);
53
+ #else
54
+ vector<T, N> div = X / Y;
55
+ vector<T, N> result = __builtin_hlsl_elementwise_frac (__builtin_elementwise_abs (div)) * Y;
56
+ vector<bool , N> condition = (div >= -div);
57
+ vector<T, N> realResult = __builtin_hlsl_select (condition, result, -result);
58
+ return realResult;
59
+ #endif
60
+ }
61
+
48
62
template <typename T, int N>
49
63
using HLSL_FIXED_VECTOR =
50
64
vector<__detail::enable_if_t <(N > 1 && N <= 4 ), T>, N>;
You can’t perform that action at this time.
0 commit comments