1
1
#ifndef _NBL_BUILTIN_HLSL_CPP_COMPAT_IMPL_INTRINSICS_IMPL_INCLUDED_
2
2
#define _NBL_BUILTIN_HLSL_CPP_COMPAT_IMPL_INTRINSICS_IMPL_INCLUDED_
3
3
4
+ #include <nbl/builtin/hlsl/cpp_compat/basic.h>
5
+ #include <nbl/builtin/hlsl/concepts.hlsl>
6
+
4
7
namespace nbl
5
8
{
6
9
namespace hlsl
@@ -12,7 +15,7 @@ struct dot_helper
12
15
{
13
16
using scalar_type = typename vector_traits<T>::scalar_type;
14
17
15
- static inline scalar_type dot (NBL_CONST_REF_ARG (T) lhs, NBL_CONST_REF_ARG (T) rhs)
18
+ static inline scalar_type dot_product (NBL_CONST_REF_ARG (T) lhs, NBL_CONST_REF_ARG (T) rhs)
16
19
{
17
20
static array_get<T, scalar_type> getter;
18
21
scalar_type retval = getter (lhs, 0 ) * getter (rhs, 0 );
@@ -32,7 +35,7 @@ struct dot_helper<vector<FLOAT_TYPE, N> >\
32
35
using VectorType = vector <FLOAT_TYPE, N>;\
33
36
using ScalarType = typename vector_traits<VectorType>::scalar_type;\
34
37
\
35
- static inline ScalarType dot (NBL_CONST_REF_ARG (VectorType) lhs, NBL_CONST_REF_ARG (VectorType) rhs)\
38
+ static inline ScalarType dot_product (NBL_CONST_REF_ARG (VectorType) lhs, NBL_CONST_REF_ARG (VectorType) rhs)\
36
39
{\
37
40
return RETURN_VALUE;\
38
41
}\
@@ -228,7 +231,7 @@ struct find_msb_return_type<vector<Integer, N> >
228
231
template<typename Integer>
229
232
using find_lsb_return_type = find_msb_return_type<Integer>;
230
233
231
- template<typename T, typename U>
234
+ template<typename T, typename U NBL_STRUCT_CONSTRAINABLE >
232
235
struct lerp_helper;
233
236
234
237
#ifdef __HLSL_VERSION
@@ -276,7 +279,10 @@ struct lerp_helper<T, bool>
276
279
{
277
280
static inline T lerp (NBL_CONST_REF_ARG (T) x, NBL_CONST_REF_ARG (T) y, NBL_CONST_REF_ARG (bool ) a)
278
281
{
279
- return a ? y : x;
282
+ if (a)
283
+ return y;
284
+ else
285
+ return x;
280
286
}
281
287
};
282
288
0 commit comments