Skip to content

Commit 061f7d8

Browse files
committed
NBL_UNROLL macro
1 parent a1289f1 commit 061f7d8

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

include/nbl/builtin/hlsl/macros.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ inline auto functionAlias(Args&&... args) -> decltype(origFunctionName(std::forw
3434

3535
#endif
3636

37+
#ifdef __HLSL_VERSION
38+
#define NBL_UNROLL [[unroll]]
39+
#else
40+
#define NBL_UNROLL
41+
#endif
42+
3743
#ifdef __HLSL_VERSION // cause DXC is insane
3844
#define NBL_FP64_LITERAL(LIT) LIT##l
3945
#else // and nobody except GCC supports C++23 `f64` suffix on float literals

include/nbl/builtin/hlsl/math/linalg/fast_affine.hlsl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ namespace math
1818
{
1919
namespace linalg
2020
{
21-
// TODO: move to macros
22-
#ifdef __HLSL_VERSION
23-
#define NBL_UNROLL [[unroll]]
24-
#else
25-
#define NBL_UNROLL
26-
#endif
2721

2822
// Multiply matrices as-if extended to be filled with identity elements
2923
template<typename T, int N, int M, int P, int Q>
@@ -82,7 +76,6 @@ vector<T,N> promoted_mul(NBL_CONST_REF_ARG(matrix<T,N,M>) lhs, const vector<T,P>
8276
}
8377
return retval;
8478
}
85-
#undef NBL_UNROLL
8679

8780
// useful for fast computation of a Normal Matrix
8881
template<typename T, int N>

include/nbl/builtin/hlsl/shapes/aabb.hlsl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ struct union_helper<AABB<D,Scalar>>
9090
return retval;
9191
}
9292
};
93-
#define NBL_UNROLL [[unroll]]
9493
// without a translation component
9594
template<int16_t D, typename Scalar>
9695
struct transform_helper<AABB<D,Scalar>,matrix<Scalar,D,D> >
@@ -131,7 +130,6 @@ struct transform_helper<AABB<D,Scalar>,matrix<Scalar,D,D+1> >
131130
return retval;
132131
}
133132
};
134-
#undef NBL_UNROLL
135133
}
136134
}
137135

0 commit comments

Comments
 (0)