11#ifndef _NBL_BUILTIN_HLSL_CPP_COMPAT_IMPL_INTRINSICS_IMPL_INCLUDED_
22#define _NBL_BUILTIN_HLSL_CPP_COMPAT_IMPL_INTRINSICS_IMPL_INCLUDED_
33
4+ #include <nbl/builtin/hlsl/cpp_compat/basic.h>
5+ #include <nbl/builtin/hlsl/concepts.hlsl>
6+
47namespace nbl
58{
69namespace hlsl
@@ -12,7 +15,7 @@ struct dot_helper
1215{
1316 using scalar_type = typename vector_traits<T>::scalar_type;
1417
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)
1619 {
1720 static array_get<T, scalar_type> getter;
1821 scalar_type retval = getter (lhs, 0 ) * getter (rhs, 0 );
@@ -32,7 +35,7 @@ struct dot_helper<vector<FLOAT_TYPE, N> >\
3235 using VectorType = vector <FLOAT_TYPE, N>;\
3336 using ScalarType = typename vector_traits<VectorType>::scalar_type;\
3437\
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)\
3639 {\
3740 return RETURN_VALUE;\
3841 }\
@@ -228,7 +231,7 @@ struct find_msb_return_type<vector<Integer, N> >
228231template<typename Integer>
229232using find_lsb_return_type = find_msb_return_type<Integer>;
230233
231- template<typename T, typename U>
234+ template<typename T, typename U NBL_STRUCT_CONSTRAINABLE >
232235struct lerp_helper;
233236
234237#ifdef __HLSL_VERSION
@@ -276,7 +279,10 @@ struct lerp_helper<T, bool>
276279{
277280 static inline T lerp (NBL_CONST_REF_ARG (T) x, NBL_CONST_REF_ARG (T) y, NBL_CONST_REF_ARG (bool ) a)
278281 {
279- return a ? y : x;
282+ if (a)
283+ return y;
284+ else
285+ return x;
280286 }
281287};
282288
0 commit comments