-
-
Notifications
You must be signed in to change notification settings - Fork 163
/
math_compat.msl
109 lines (81 loc) · 1.87 KB
/
math_compat.msl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef METAL_COMPAT_FUNCS
#define METAL_COMPAT_FUNCS
inline bool2 lessThan(float2 x, float2 y) {
return x < y;
}
inline bool3 lessThan(float3 x, float3 y) {
return x < y;
}
inline bool4 lessThan(float4 x, float4 y) {
return x < y;
}
inline bool2 lessThanEqual(float2 x, float2 y) {
return x <= y;
}
inline bool3 lessThanEqual(float3 x, float3 y) {
return x <= y;
}
inline bool4 lessThanEqual(float4 x, float4 y) {
return x <= y;
}
inline bool2 greaterThan(float2 x, float2 y) {
return x > y;
}
inline bool3 greaterThan(float3 x, float3 y) {
return x > y;
}
inline bool4 greaterThan(float4 x, float4 y) {
return x > y;
}
inline bool2 greaterThanEqual(float2 x, float2 y) {
return x >= y;
}
inline bool3 greaterThanEqual(float3 x, float3 y) {
return x >= y;
}
inline bool4 greaterThanEqual(float4 x, float4 y) {
return x >= y;
}
inline bool2 equal(float2 x, float2 y) {
return x == y;
}
inline bool3 equal(float3 x, float3 y) {
return x == y;
}
inline bool4 equal(float4 x, float4 y) {
return x == y;
}
inline bool2 notEqual(float2 x, float2 y) {
return x != y;
}
inline bool3 notEqual(float3 x, float3 y) {
return x != y;
}
inline bool4 notEqual(float4 x, float4 y) {
return x != y;
}
// Scalar mod function (float)
inline float mod(float x, float y) {
return fmod(x, y);
}
// Vector mod functions (float2, float3, float4)
inline float2 mod(float2 x, float2 y) {
return fmod(x, y);
}
inline float3 mod(float3 x, float3 y) {
return fmod(x, y);
}
inline float4 mod(float4 x, float4 y) {
return fmod(x, y);
}
// Scalar mod function with scalar divisor (float2, float3, float4)
inline float2 mod(float2 x, float y) {
return fmod(x, float2(y));
}
inline float3 mod(float3 x, float y) {
return fmod(x, float3(y));
}
inline float4 mod(float4 x, float y) {
return fmod(x, float4(y));
}
#endif