Skip to content

Commit 228e297

Browse files
committed
added generic unroll range to algorithm
1 parent 4b7ac8f commit 228e297

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

include/nbl/builtin/hlsl/algorithm.hlsl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,26 @@ uint upper_bound(NBL_REF_ARG(Accessor) accessor, const uint begin, const uint en
224224
return impl::upper_bound<Accessor,typename Accessor::value_type>(accessor,begin,end,value);
225225
}
226226

227+
228+
template<int begin, int end>
229+
struct unrolled_for_range;
230+
template<int end>
231+
struct unrolled_for_range<end,end>
232+
{
233+
template<typename F>
234+
static void __call(inout F f) {}
235+
};
236+
template<int begin, int end>
237+
struct unrolled_for_range
238+
{
239+
template<typename F>
240+
static void __call(inout F f)
241+
{
242+
f.template __call<begin>();
243+
unrolled_for<begin+1,end>::template __call<F>(f);
244+
}
245+
};
246+
227247
#endif
228248
}
229249
}

0 commit comments

Comments
 (0)