Skip to content

Commit 172748a

Browse files
committed
Corrections
1 parent 2e151f6 commit 172748a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

include/nbl/builtin/hlsl/cpp_compat/impl/intrinsics_impl.hlsl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
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+
47
namespace nbl
58
{
69
namespace 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> >
228231
template<typename Integer>
229232
using 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>
232235
struct 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

include/nbl/builtin/hlsl/cpp_compat/intrinsics.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ T clamp(NBL_CONST_REF_ARG(T) val, NBL_CONST_REF_ARG(T) min, NBL_CONST_REF_ARG(T)
6262
template<typename T>
6363
typename vector_traits<T>::scalar_type dot(NBL_CONST_REF_ARG(T) lhs, NBL_CONST_REF_ARG(T) rhs)
6464
{
65-
return cpp_compat_intrinsics_impl::dot_helper<T>::dot(lhs, rhs);
65+
return cpp_compat_intrinsics_impl::dot_helper<T>::dot_product(lhs, rhs);
6666
}
6767

6868
// TODO: for clearer error messages, use concepts to ensure that input type is a square matrix

0 commit comments

Comments
 (0)