Skip to content

Commit cf3e18d

Browse files
committed
Corrections
1 parent a1034bb commit cf3e18d

File tree

8 files changed

+144
-55
lines changed

8 files changed

+144
-55
lines changed

include/nbl/builtin/hlsl/concepts/core.hlsl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ NBL_BOOL_CONCEPT UnsignedIntegralScalar = !nbl::hlsl::is_signed_v<T> && ::nbl::h
4949
template<typename T>
5050
NBL_BOOL_CONCEPT FloatingPointScalar = nbl::hlsl::is_floating_point_v<T> && nbl::hlsl::is_scalar_v<T>;
5151

52+
template<typename T>
53+
NBL_BOOL_CONCEPT BooleanScalar = concepts::Boolean<T> && nbl::hlsl::is_scalar_v<T>;
54+
5255
// TODO: implement when hlsl::is_base_of is done
5356
//#define NBL_CONCEPT_NAME DerivedFrom
5457
// ...

include/nbl/builtin/hlsl/concepts/vector.hlsl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ template<typename T>
4343
NBL_BOOL_CONCEPT SignedIntVectorial = concepts::Vectorial<T> && concepts::SignedIntegralScalar<typename vector_traits<T>::scalar_type>;
4444

4545
}
46+
47+
template<typename Vectorial>
48+
NBL_PARTIAL_REQ_TOP(concepts::Vectorial<Vectorial>)
49+
struct extent<Vectorial, 0 NBL_PARTIAL_REQ_BOT(concepts::Vectorial<Vectorial>) > : integral_constant<uint64_t, vector_traits<Vectorial>::Dimension> {};
50+
4651
}
4752
}
4853
#endif

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

Lines changed: 62 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <boost/preprocessor/punctuation/comma_if.hpp>
1717
#include <boost/preprocessor/seq/for_each_i.hpp>
1818

19-
2019
namespace nbl
2120
{
2221
namespace hlsl
@@ -63,7 +62,7 @@ struct any_helper;
6362
template<typename T NBL_STRUCT_CONSTRAINABLE>
6463
struct bitReverseAs_helper;
6564
template<typename T NBL_STRUCT_CONSTRAINABLE>
66-
struct frac_helper;
65+
struct fract_helper;
6766
template<typename T, typename U NBL_STRUCT_CONSTRAINABLE>
6867
struct mix_helper;
6968
template<typename T NBL_STRUCT_CONSTRAINABLE>
@@ -123,7 +122,7 @@ template<typename T> AUTO_SPECIALIZE_TRIVIAL_CASE_HELPER(transpose_helper, trans
123122
template<typename T> AUTO_SPECIALIZE_TRIVIAL_CASE_HELPER(length_helper, length, (T), (T), typename vector_traits<T>::scalar_type)
124123
template<typename T> AUTO_SPECIALIZE_TRIVIAL_CASE_HELPER(normalize_helper, normalize, (T), (T), T)
125124
template<typename T> AUTO_SPECIALIZE_TRIVIAL_CASE_HELPER(rsqrt_helper, inverseSqrt, (T), (T), T)
126-
template<typename T> AUTO_SPECIALIZE_TRIVIAL_CASE_HELPER(frac_helper, fract, (T), (T), T)
125+
template<typename T> AUTO_SPECIALIZE_TRIVIAL_CASE_HELPER(fract_helper, fract, (T), (T), T)
127126
template<typename T> AUTO_SPECIALIZE_TRIVIAL_CASE_HELPER(all_helper, any, (T), (T), T)
128127
template<typename T> AUTO_SPECIALIZE_TRIVIAL_CASE_HELPER(any_helper, any, (T), (T), T)
129128
template<typename T> AUTO_SPECIALIZE_TRIVIAL_CASE_HELPER(sign_helper, fSign, (T), (T), T)
@@ -212,14 +211,23 @@ struct inverse_helper<SquareMatrix NBL_PARTIAL_REQ_BOT(concepts::Matrix<SquareMa
212211
}
213212
};
214213

215-
template<typename T, typename U> NBL_PARTIAL_REQ_TOP(always_true<decltype(spirv::fMix<T>(experimental::declval<T>(), experimental::declval<T>(), experimental::declval<U>()))>)
216-
struct mix_helper<T, U NBL_PARTIAL_REQ_BOT(always_true<decltype(spirv::fMix<T>(experimental::declval<T>(), experimental::declval<T>(), experimental::declval<U>()))>) >
214+
template<typename T> NBL_PARTIAL_REQ_TOP(always_true<decltype(spirv::fMix<T>(experimental::declval<T>(), experimental::declval<T>(), experimental::declval<T>()))>)
215+
struct mix_helper<T, T NBL_PARTIAL_REQ_BOT(always_true<decltype(spirv::fMix<T>(experimental::declval<T>(), experimental::declval<T>(), experimental::declval<T>()))>) >
217216
{
218217
using return_t = conditional_t<is_vector_v<T>, vector<typename vector_traits<T>::scalar_type, vector_traits<T>::Dimension>, T>;
219-
static inline return_t __call(const T x, const T y, const U a)
218+
static inline return_t __call(const T x, const T y, const T a)
219+
{
220+
return spirv::fMix<T>(x, y, a);
221+
}
222+
};
223+
224+
template<typename T> NBL_PARTIAL_REQ_TOP(concepts::FloatingPointScalar<T>)
225+
struct mix_helper<T, bool NBL_PARTIAL_REQ_BOT(concepts::FloatingPointScalar<T>) >
226+
{
227+
using return_t = conditional_t<is_vector_v<T>, vector<typename vector_traits<T>::scalar_type, vector_traits<T>::Dimension>, T>;
228+
static inline return_t __call(const T x, const T y, const bool a)
220229
{
221-
T aAsT = a;
222-
return spirv::fMix<T>(x, y, aAsT);
230+
return a ? x : y;
223231
}
224232
};
225233

@@ -287,7 +295,8 @@ struct transpose_helper<Matrix>
287295

288296
static transposed_t __call(NBL_CONST_REF_ARG(Matrix) m)
289297
{
290-
return reinterpret_cast<transposed_t&>(glm::transpose(reinterpret_cast<typename Matrix::Base const&>(m)));
298+
using traits = matrix_traits<Matrix>;
299+
return reinterpret_cast<transposed_t&>(glm::transpose<traits::ColumnCount, traits::RowCount, traits::scalar_type, glm::qualifier::highp>(reinterpret_cast<typename Matrix::Base const&>(m)));
291300
}
292301
};
293302
template<typename Vector>
@@ -367,7 +376,7 @@ struct rsqrt_helper<FloatingPoint>
367376

368377
template<typename T>
369378
requires concepts::FloatingPointScalar<T>
370-
struct frac_helper<T>
379+
struct fract_helper<T>
371380
{
372381
using return_t = T;
373382
static inline return_t __call(const T x)
@@ -394,7 +403,8 @@ struct inverse_helper<SquareMatrix>
394403
{
395404
static SquareMatrix __call(NBL_CONST_REF_ARG(SquareMatrix) mat)
396405
{
397-
return reinterpret_cast<SquareMatrix&>(glm::inverse(reinterpret_cast<typename SquareMatrix::Base const&>(mat)));
406+
using traits = matrix_traits<SquareMatrix>;
407+
return reinterpret_cast<SquareMatrix&>(glm::inverse<traits::ColumnCount, traits::RowCount, traits::scalar_type, glm::qualifier::highp>(reinterpret_cast<typename SquareMatrix::Base const&>(mat)));
398408
}
399409
};
400410

@@ -411,13 +421,13 @@ struct bitCount_helper<EnumT>
411421
};
412422

413423
template<typename T, typename U>
414-
requires (concepts::FloatingPoint<T> && (concepts::FloatingPoint<U> || concepts::Boolean<U>))
424+
requires (concepts::FloatingPointScalar<T> && (concepts::FloatingPointScalar<U> || concepts::BooleanScalar<U>))
415425
struct mix_helper<T, U>
416426
{
417427
using return_t = T;
418428
static inline return_t __call(const T x, const T y, const U a)
419429
{
420-
return glm::mix(x, y, a);
430+
return glm::mix<T, U>(x, y, a);
421431
}
422432
};
423433

@@ -532,15 +542,27 @@ struct refract_helper<T, U>
532542
}
533543
};
534544

545+
template<typename UnsignedInteger NBL_FUNC_REQUIRES(hlsl::is_integral_v<UnsignedInteger>&& hlsl::is_unsigned_v<UnsignedInteger>)
546+
inline bool isnan_uint_impl(UnsignedInteger val)
547+
{
548+
using AsFloat = typename float_of_size<sizeof(UnsignedInteger)>::type;
549+
constexpr UnsignedInteger Mask = ~static_cast<UnsignedInteger>(0);
550+
UnsignedInteger absVal = val & Mask;
551+
return absVal > (ieee754::traits<AsFloat>::specialValueExp << ieee754::traits<AsFloat>::mantissaBitCnt);
552+
}
553+
535554
template<typename T>
536555
requires concepts::FloatingPoint<T>
537556
struct nMin_helper<T>
538557
{
539558
using return_t = T;
540559
static inline return_t __call(const T a, const T b)
541560
{
561+
using AsUint = typename unsigned_integer_of_size<sizeof(T)>::type;
562+
const bool isANaN = isnan_uint_impl(reinterpret_cast<const AsUint&>(a));
563+
542564
// comparison involving any NaN always returns false
543-
return (b < a || std::isnan(a)) ? b : a;
565+
return (b < a || isANaN) ? b : a;
544566
}
545567
};
546568

@@ -551,8 +573,11 @@ struct nMax_helper<T>
551573
using return_t = T;
552574
static inline return_t __call(const T a, const T b)
553575
{
576+
using AsUint = typename unsigned_integer_of_size<sizeof(T)>::type;
577+
const bool isANaN = isnan_uint_impl(reinterpret_cast<const AsUint&>(a));
578+
554579
// comparison involving any NaN always returns false
555-
return (a < b || std::isnan(a)) ? b : a;
580+
return (a < b || isANaN) ? b : a;
556581
}
557582
};
558583

@@ -729,7 +754,7 @@ struct HELPER_NAME<T NBL_PARTIAL_REQ_BOT(REQUIREMENT) >\
729754

730755
AUTO_SPECIALIZE_HELPER_FOR_VECTOR(rsqrt_helper, concepts::FloatingPointVectorial<T> && VECTOR_SPECIALIZATION_CONCEPT, T)
731756
AUTO_SPECIALIZE_HELPER_FOR_VECTOR(bitReverse_helper, VECTOR_SPECIALIZATION_CONCEPT, T)
732-
AUTO_SPECIALIZE_HELPER_FOR_VECTOR(frac_helper, VECTOR_SPECIALIZATION_CONCEPT,T)
757+
AUTO_SPECIALIZE_HELPER_FOR_VECTOR(fract_helper, VECTOR_SPECIALIZATION_CONCEPT,T)
733758
AUTO_SPECIALIZE_HELPER_FOR_VECTOR(sign_helper, VECTOR_SPECIALIZATION_CONCEPT, T)
734759
AUTO_SPECIALIZE_HELPER_FOR_VECTOR(degrees_helper, VECTOR_SPECIALIZATION_CONCEPT, T)
735760
AUTO_SPECIALIZE_HELPER_FOR_VECTOR(radians_helper, VECTOR_SPECIALIZATION_CONCEPT, T)
@@ -816,6 +841,27 @@ struct smoothStep_helper<T NBL_PARTIAL_REQ_BOT(VECTOR_SPECIALIZATION_CONCEPT) >
816841
}
817842
};
818843

844+
template<typename T, typename U>
845+
NBL_PARTIAL_REQ_TOP(VECTOR_SPECIALIZATION_CONCEPT && vector_traits<T>::Dimension == vector_traits<U>::Dimension)
846+
struct mix_helper<T, U NBL_PARTIAL_REQ_BOT(VECTOR_SPECIALIZATION_CONCEPT && vector_traits<T>::Dimension == vector_traits<U>::Dimension) >
847+
{
848+
using return_t = T;
849+
static return_t __call(NBL_CONST_REF_ARG(T) x, NBL_CONST_REF_ARG(T) y, NBL_CONST_REF_ARG(U) a)
850+
{
851+
using traitsT = hlsl::vector_traits<T>;
852+
using traitsU = hlsl::vector_traits<U>;
853+
array_get<T, typename traitsT::scalar_type> getterT;
854+
array_get<U, typename traitsU::scalar_type> getterU;
855+
array_set<return_t, typename traitsT::scalar_type> setter;
856+
857+
return_t output;
858+
for (uint32_t i = 0; i < traitsT::Dimension; ++i)
859+
setter(output, i, mix_helper<typename traitsT::scalar_type, typename traitsU::scalar_type>::__call(getterT(x, i), getterT(y, i), getterU(a, i)));
860+
861+
return output;
862+
}
863+
};
864+
819865
}
820866
}
821867
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ inline bool any(Vector vec)
158158
* @param [in] val The value to operate on.
159159
*/
160160
template<typename T>
161-
inline T frac(NBL_CONST_REF_ARG(T) val)
161+
inline T fract(NBL_CONST_REF_ARG(T) val)
162162
{
163-
return cpp_compat_intrinsics_impl::frac_helper<T>::__call(val);
163+
return cpp_compat_intrinsics_impl::fract_helper<T>::__call(val);
164164
}
165165

166166
template<typename T, typename U>

include/nbl/builtin/hlsl/tgmath/impl.hlsl

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#include <nbl/builtin/hlsl/concepts/vector.hlsl>
77
#include <nbl/builtin/hlsl/spirv_intrinsics/core.hlsl>
88
#include <nbl/builtin/hlsl/spirv_intrinsics/glsl.std.450.hlsl>
9-
#include <nbl/builtin/hlsl/ieee754.hlsl>
109
#include <nbl/builtin/hlsl/tgmath/output_structs.hlsl>
10+
#include <nbl/builtin/hlsl/cpp_compat/intrinsics.hlsl>
1111

1212
// C++ includes
1313
#ifndef __HLSL_VERSION
@@ -22,13 +22,14 @@ namespace hlsl
2222
namespace tgmath_impl
2323
{
2424

25-
template<typename UnsignedInteger NBL_FUNC_REQUIRES(hlsl::is_integral_v<UnsignedInteger> && hlsl::is_unsigned_v<UnsignedInteger>)
25+
template<typename UnsignedInteger NBL_FUNC_REQUIRES(hlsl::is_integral_v<UnsignedInteger>&& hlsl::is_unsigned_v<UnsignedInteger>)
2626
inline bool isnan_uint_impl(UnsignedInteger val)
2727
{
2828
using AsFloat = typename float_of_size<sizeof(UnsignedInteger)>::type;
2929
UnsignedInteger absVal = val & (hlsl::numeric_limits<UnsignedInteger>::max >> 1);
3030
return absVal > (ieee754::traits<AsFloat>::specialValueExp << ieee754::traits<AsFloat>::mantissaBitCnt);
3131
}
32+
3233
template<typename UnsignedInteger NBL_FUNC_REQUIRES(hlsl::is_integral_v<UnsignedInteger>&& hlsl::is_unsigned_v<UnsignedInteger>)
3334
inline bool isinf_uint_impl(UnsignedInteger val)
3435
{
@@ -207,18 +208,18 @@ struct erf_helper<FloatingPoint NBL_PARTIAL_REQ_BOT(concepts::FloatingPointScala
207208
{
208209
static FloatingPoint __call(NBL_CONST_REF_ARG(FloatingPoint) _x)
209210
{
210-
const FloatingPoint a1 = FloatingPoint(0.254829592);
211-
const FloatingPoint a2 = FloatingPoint(-0.284496736);
212-
const FloatingPoint a3 = FloatingPoint(1.421413741);
213-
const FloatingPoint a4 = FloatingPoint(-1.453152027);
214-
const FloatingPoint a5 = FloatingPoint(1.061405429);
215-
const FloatingPoint p = FloatingPoint(0.3275911);
211+
const FloatingPoint a1 = FloatingPoint(NBL_FP64_LITERAL(0.254829592));
212+
const FloatingPoint a2 = FloatingPoint(NBL_FP64_LITERAL(-0.284496736));
213+
const FloatingPoint a3 = FloatingPoint(NBL_FP64_LITERAL(1.421413741));
214+
const FloatingPoint a4 = FloatingPoint(NBL_FP64_LITERAL(-1.453152027));
215+
const FloatingPoint a5 = FloatingPoint(NBL_FP64_LITERAL(1.061405429));
216+
const FloatingPoint p = FloatingPoint(NBL_FP64_LITERAL(0.3275911));
216217

217218
FloatingPoint _sign = FloatingPoint(sign(_x));
218219
FloatingPoint x = abs(_x);
219220

220-
FloatingPoint t = FloatingPoint(1.0) / (FloatingPoint(1.0) + p * x);
221-
FloatingPoint y = FloatingPoint(1.0) - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * exp(-x * x);
221+
FloatingPoint t = FloatingPoint(NBL_FP64_LITERAL(1.0)) / (FloatingPoint(NBL_FP64_LITERAL(1.0)) + p * x);
222+
FloatingPoint y = FloatingPoint(NBL_FP64_LITERAL(1.0)) - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * exp(-x * x);
222223

223224
return _sign * y;
224225
}
@@ -304,7 +305,7 @@ struct isinf_helper<T>
304305
static inline return_t __call(const T arg)
305306
{
306307
// GCC and Clang will always return false with call to std::isinf when fast math is enabled,
307-
// this implementation will always return appropriate output regardless is fas math is enabled or not
308+
// this implementation will always return appropriate output regardless is fast math is enabled or not
308309
using AsUint = typename unsigned_integer_of_size<sizeof(T)>::type;
309310
return tgmath_impl::isinf_uint_impl(reinterpret_cast<const AsUint&>(arg));
310311
}
@@ -318,7 +319,7 @@ struct isnan_helper<T>
318319
static inline return_t __call(const T arg)
319320
{
320321
// GCC and Clang will always return false with call to std::isnan when fast math is enabled,
321-
// this implementation will always return appropriate output regardless is fas math is enabled or not
322+
// this implementation will always return appropriate output regardless is fast math is enabled or not
322323
using AsUint = typename unsigned_integer_of_size<sizeof(T)>::type;
323324
return tgmath_impl::isnan_uint_impl(reinterpret_cast<const AsUint&>(arg));
324325
}
@@ -413,35 +414,35 @@ struct erfInv_helper<FloatingPoint NBL_PARTIAL_REQ_BOT(concepts::FloatingPointSc
413414
{
414415
static FloatingPoint __call(NBL_CONST_REF_ARG(FloatingPoint) _x)
415416
{
416-
FloatingPoint x = clamp<FloatingPoint>(_x, FloatingPoint(-0.99999), FloatingPoint(0.99999));
417+
FloatingPoint x = clamp<FloatingPoint>(_x, FloatingPoint(NBL_FP64_LITERAL(-0.99999)), FloatingPoint(NBL_FP64_LITERAL(0.99999)));
417418

418-
FloatingPoint w = -log_helper<FloatingPoint>::__call((FloatingPoint(1.0) - x) * (FloatingPoint(1.0) + x));
419+
FloatingPoint w = -log_helper<FloatingPoint>::__call((FloatingPoint(NBL_FP64_LITERAL(1.0)) - x) * (FloatingPoint(NBL_FP64_LITERAL(1.0)) + x));
419420
FloatingPoint p;
420421
if (w < 5.0)
421422
{
422-
w -= FloatingPoint(2.5);
423-
p = FloatingPoint(2.81022636e-08);
424-
p = FloatingPoint(3.43273939e-07) + p * w;
425-
p = FloatingPoint(-3.5233877e-06) + p * w;
426-
p = FloatingPoint(-4.39150654e-06) + p * w;
427-
p = FloatingPoint(0.00021858087) + p * w;
428-
p = FloatingPoint(-0.00125372503) + p * w;
429-
p = FloatingPoint(-0.00417768164) + p * w;
430-
p = FloatingPoint(0.246640727) + p * w;
431-
p = FloatingPoint(1.50140941) + p * w;
423+
w -= FloatingPoint(NBL_FP64_LITERAL(2.5));
424+
p = FloatingPoint(NBL_FP64_LITERAL(2.81022636e-08));
425+
p = FloatingPoint(NBL_FP64_LITERAL(3.43273939e-07)) + p * w;
426+
p = FloatingPoint(NBL_FP64_LITERAL(-3.5233877e-06)) + p * w;
427+
p = FloatingPoint(NBL_FP64_LITERAL(-4.39150654e-06)) + p * w;
428+
p = FloatingPoint(NBL_FP64_LITERAL(0.00021858087)) + p * w;
429+
p = FloatingPoint(NBL_FP64_LITERAL(-0.00125372503)) + p * w;
430+
p = FloatingPoint(NBL_FP64_LITERAL(-0.00417768164)) + p * w;
431+
p = FloatingPoint(NBL_FP64_LITERAL(0.246640727)) + p * w;
432+
p = FloatingPoint(NBL_FP64_LITERAL(1.50140941)) + p * w;
432433
}
433434
else
434435
{
435-
w = sqrt_helper<FloatingPoint>::__call(w) - FloatingPoint(3.0);
436-
p = FloatingPoint(-0.000200214257);
437-
p = FloatingPoint(0.000100950558) + p * w;
438-
p = FloatingPoint(0.00134934322) + p * w;
439-
p = FloatingPoint(-0.00367342844) + p * w;
440-
p = FloatingPoint(0.00573950773) + p * w;
441-
p = FloatingPoint(-0.0076224613) + p * w;
442-
p = FloatingPoint(0.00943887047) + p * w;
443-
p = FloatingPoint(1.00167406) + p * w;
444-
p = FloatingPoint(2.83297682) + p * w;
436+
w = sqrt_helper<FloatingPoint>::__call(w) - FloatingPoint(NBL_FP64_LITERAL(3.0));
437+
p = FloatingPoint(NBL_FP64_LITERAL(-0.000200214257));
438+
p = FloatingPoint(NBL_FP64_LITERAL(0.000100950558)) + p * w;
439+
p = FloatingPoint(NBL_FP64_LITERAL(0.00134934322)) + p * w;
440+
p = FloatingPoint(NBL_FP64_LITERAL(-0.00367342844)) + p * w;
441+
p = FloatingPoint(NBL_FP64_LITERAL(0.00573950773)) + p * w;
442+
p = FloatingPoint(NBL_FP64_LITERAL(-0.0076224613)) + p * w;
443+
p = FloatingPoint(NBL_FP64_LITERAL(0.00943887047)) + p * w;
444+
p = FloatingPoint(NBL_FP64_LITERAL(1.00167406)) + p * w;
445+
p = FloatingPoint(NBL_FP64_LITERAL(2.83297682)) + p * w;
445446
}
446447
return p * x;
447448
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#ifndef _NBL_BUILTIN_HLSL_TGMATH_ISNAN_ISINF_INCLUDED_
2+
#define _NBL_BUILTIN_HLSL_TGMATH_ISNAN_ISINF_INCLUDED_
3+
4+
#include <nbl/builtin/hlsl/cpp_compat/basic.h>
5+
#include <nbl/builtin/hlsl/concepts.hlsl>
6+
#include <nbl/builtin/hlsl/ieee754.hlsl>
7+
8+
namespace nbl
9+
{
10+
namespace hlsl
11+
{
12+
namespace tgmath_impl
13+
{
14+
15+
template<typename UnsignedInteger NBL_FUNC_REQUIRES(hlsl::is_integral_v<UnsignedInteger> && hlsl::is_unsigned_v<UnsignedInteger>)
16+
inline bool isnan_uint_impl(UnsignedInteger val)
17+
{
18+
using AsFloat = typename float_of_size<sizeof(UnsignedInteger)>::type;
19+
UnsignedInteger absVal = val & (hlsl::numeric_limits<UnsignedInteger>::max >> 1);
20+
return absVal > (ieee754::traits<AsFloat>::specialValueExp << ieee754::traits<AsFloat>::mantissaBitCnt);
21+
}
22+
template<typename UnsignedInteger NBL_FUNC_REQUIRES(hlsl::is_integral_v<UnsignedInteger>&& hlsl::is_unsigned_v<UnsignedInteger>)
23+
inline bool isinf_uint_impl(UnsignedInteger val)
24+
{
25+
using AsFloat = typename float_of_size<sizeof(UnsignedInteger)>::type;
26+
return (val & (~ieee754::traits<AsFloat>::signMask)) == ieee754::traits<AsFloat>::inf;
27+
}
28+
29+
}
30+
}
31+
}
32+
33+
#endif

0 commit comments

Comments
 (0)