File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
include/nbl/builtin/hlsl/vector_utils Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ #ifndef _NBL_BUILTIN_HLSL_VECTOR_UTILS_VECTOR_TRAITS_INCLUDED_
2
+ #define _NBL_BUILTIN_HLSL_VECTOR_UTILS_VECTOR_TRAITS_INCLUDED_
3
+ #include <nbl/builtin/hlsl/cpp_compat/basic.h>
4
+
5
+ namespace nbl
6
+ {
7
+ namespace hlsl
8
+ {
9
+
10
+ // The whole purpose of this file is to enable the creation of partial specializations of the vector_traits for
11
+ // custom types without introducing circular dependencies.
12
+
13
+ template<typename VecT>
14
+ struct vector_traits;
15
+
16
+ // i choose to implement it this way because of this DXC bug: https://github.com/microsoft/DirectXShaderCom0piler/issues/7007
17
+ #define DEFINE_VECTOR_TRAITS_TEMPLATE_SPECIALIZATION (DIMENSION) \
18
+ template<typename T> \
19
+ struct vector_traits<vector <T, DIMENSION> > \
20
+ { \
21
+ using scalar_type = T; \
22
+ NBL_CONSTEXPR_STATIC_INLINE uint32_t Dimension = DIMENSION; \
23
+ };\
24
+
25
+ DEFINE_VECTOR_TRAITS_TEMPLATE_SPECIALIZATION (2 )
26
+ DEFINE_VECTOR_TRAITS_TEMPLATE_SPECIALIZATION (3 )
27
+ DEFINE_VECTOR_TRAITS_TEMPLATE_SPECIALIZATION (4 )
28
+
29
+ }
30
+ }
31
+
32
+ #endif
You can’t perform that action at this time.
0 commit comments