File tree Expand file tree Collapse file tree 1 file changed +72
-0
lines changed Expand file tree Collapse file tree 1 file changed +72
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright (C) 2022 - DevSH Graphics Programming Sp. z O.O.
2
+ // This file is part of the "Nabla Engine".
3
+ // For conditions of distribution and use, see copyright notice in nabla.h
4
+ #ifndef _NBL_BUILTIN_HLSL_MACROS_INCLUDED_
5
+ #define _NBL_BUILTIN_HLSL_MACROS_INCLUDED_
6
+ // TODO (PentaKon): Should this file be renamed to binops.hlsl ?
7
+ // TODO (PentaKon): Should we move isNPoT from algorithm.hlsl to this file ?
8
+ namespace nbl
9
+ {
10
+ namespace hlsl
11
+ {
12
+ // TODO (PentaKon): NBL_GLSL_EVAL? Keep as macro or don't use at all?
13
+ namespace binops
14
+ {
15
+ template<typename T>
16
+ struct and
17
+ {
18
+ T operator ()(const T lhs, const T rhs)
19
+ {
20
+ return lhs&rhs;
21
+ }
22
+ };
23
+
24
+ template<typename T>
25
+ struct or
26
+ {
27
+ T operator ()(const T lhs, const T rhs)
28
+ {
29
+ return lhs|rhs;
30
+ }
31
+ };
32
+
33
+ template<typename T>
34
+ struct xor
35
+ {
36
+ T operator ()(const T lhs, const T rhs)
37
+ {
38
+ return lhs^rhs;
39
+ }
40
+ };
41
+
42
+ template<typename T>
43
+ struct mul
44
+ {
45
+ T operator ()(const T lhs, const T rhs)
46
+ {
47
+ return lhs*rhs;
48
+ }
49
+ };
50
+
51
+ template<typename T>
52
+ struct min
53
+ {
54
+ T operator ()(const T lhs, const T rhs)
55
+ {
56
+ return lhs>rhs ? rhs : lhs;
57
+ }
58
+ };
59
+
60
+ template<typename T>
61
+ struct max
62
+ {
63
+ T operator ()(const T lhs, const T rhs)
64
+ {
65
+ return lhs>rhs ? lhs : rhs;
66
+ }
67
+ };
68
+
69
+ }
70
+ }
71
+ }
72
+ #endif
You can’t perform that action at this time.
0 commit comments