Skip to content

Commit 8445511

Browse files
Merge pull request #844 from Devsh-Graphics-Programming/hlsl_func_fixes
Fixed float16_t concepts
2 parents 4f98026 + 2ae81f4 commit 8445511

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

include/nbl/builtin/hlsl/type_traits.hlsl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ concept is_scoped_enum = std::is_enum_v<E> && !std::is_convertible_v<E, std::und
1515
#include <nbl/builtin/hlsl/cpp_compat/basic.h>
1616
#include <nbl/builtin/hlsl/concepts.hlsl>
1717

18-
1918
// Since HLSL currently doesnt allow type aliases we declare them as seperate structs thus they are (WORKAROUND)s
2019
/*
2120
// helper class
@@ -516,7 +515,7 @@ template<class T>
516515
using is_unbounded_array = std::is_unbounded_array<T>;
517516

518517
template<class T>
519-
using is_scalar = std::is_scalar<T>;
518+
struct is_scalar : std::bool_constant<std::is_scalar_v<T> || std::is_same_v<T, float16_t>> {};
520519

521520
template<class T>
522521
struct is_signed : impl::base_type_forwarder<std::is_signed, T> {};
@@ -527,8 +526,14 @@ struct is_unsigned : impl::base_type_forwarder<std::is_unsigned, T> {};
527526
template<class T>
528527
struct is_integral : impl::base_type_forwarder<std::is_integral, T> {};
529528

529+
namespace impl
530+
{
531+
template<typename T>
532+
struct is_floating_point : std::bool_constant<std::is_floating_point_v<T> || std::is_same_v<T, float16_t>> {};
533+
}
534+
530535
template<class T>
531-
struct is_floating_point : impl::base_type_forwarder<std::is_floating_point, T> {};
536+
struct is_floating_point : impl::base_type_forwarder<impl::is_floating_point, T> {};
532537

533538
template<class T>
534539
using is_const = std::is_const<T>;

0 commit comments

Comments
 (0)