Skip to content

Commit 83d27c9

Browse files
author
kevyuu
committed
NBL_CONSTEXPR_INLINE_VAR for template constexpr variable
1 parent e320ed8 commit 83d27c9

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

include/nbl/builtin/hlsl/cpp_compat/basic.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#define NBL_CONSTEXPR_STATIC constexpr static
1414
#define NBL_CONSTEXPR_STATIC_INLINE constexpr static inline
1515
#define NBL_CONSTEXPR_INLINE_FUNC constexpr inline
16+
#define NBL_CONSTEXPR_INLINE_VAR constexpr inline
1617
#define NBL_CONSTEXPR_FORCED_INLINE_FUNC NBL_FORCE_INLINE constexpr
1718
#define NBL_CONST_MEMBER_FUNC const
1819
#define NBL_IF_CONSTEXPR(...) if constexpr (__VA_ARGS__)
@@ -44,6 +45,7 @@ namespace nbl::hlsl
4445
#define NBL_CONSTEXPR_STATIC const static
4546
#define NBL_CONSTEXPR_STATIC_INLINE const static
4647
#define NBL_CONSTEXPR_INLINE_FUNC inline
48+
#define NBL_CONSTEXPR_INLINE_VAR inline
4749
#define NBL_CONSTEXPR_FORCED_INLINE_FUNC inline
4850
#define NBL_CONST_MEMBER_FUNC
4951
#define NBL_IF_CONSTEXPR(...) if (__VA_ARGS__)

include/nbl/builtin/hlsl/emulated/int64_t.hlsl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -435,13 +435,13 @@ struct minus<emulated_int64_base<Signed> >
435435
};
436436

437437
template<>
438-
NBL_CONSTEXPR emulated_uint64_t plus<emulated_uint64_t>::identity = _static_cast<emulated_uint64_t>(uint64_t(0));
438+
NBL_CONSTEXPR_INLINE_VAR emulated_uint64_t plus<emulated_uint64_t>::identity = _static_cast<emulated_uint64_t>(uint64_t(0));
439439
template<>
440-
NBL_CONSTEXPR emulated_int64_t plus<emulated_int64_t>::identity = _static_cast<emulated_int64_t>(int64_t(0));
440+
NBL_CONSTEXPR_INLINE_VAR emulated_int64_t plus<emulated_int64_t>::identity = _static_cast<emulated_int64_t>(int64_t(0));
441441
template<>
442-
NBL_CONSTEXPR emulated_uint64_t minus<emulated_uint64_t>::identity = _static_cast<emulated_uint64_t>(uint64_t(0));
442+
NBL_CONSTEXPR_INLINE_VAR emulated_uint64_t minus<emulated_uint64_t>::identity = _static_cast<emulated_uint64_t>(uint64_t(0));
443443
template<>
444-
NBL_CONSTEXPR emulated_int64_t minus<emulated_int64_t>::identity = _static_cast<emulated_int64_t>(int64_t(0));
444+
NBL_CONSTEXPR_INLINE_VAR emulated_int64_t minus<emulated_int64_t>::identity = _static_cast<emulated_int64_t>(int64_t(0));
445445

446446
// --------------------------------- Compound assignment operators ------------------------------------------
447447
// Specializations of the structs found in functional.hlsl
@@ -475,13 +475,13 @@ struct minus_assign<emulated_int64_base<Signed> >
475475
};
476476

477477
template<>
478-
NBL_CONSTEXPR emulated_uint64_t plus_assign<emulated_uint64_t>::identity = plus<emulated_uint64_t>::identity;
478+
NBL_CONSTEXPR_INLINE_VAR emulated_uint64_t plus_assign<emulated_uint64_t>::identity = plus<emulated_uint64_t>::identity;
479479
template<>
480-
NBL_CONSTEXPR emulated_int64_t plus_assign<emulated_int64_t>::identity = plus<emulated_int64_t>::identity;
480+
NBL_CONSTEXPR_INLINE_VAR emulated_int64_t plus_assign<emulated_int64_t>::identity = plus<emulated_int64_t>::identity;
481481
template<>
482-
NBL_CONSTEXPR emulated_uint64_t minus_assign<emulated_uint64_t>::identity = minus<emulated_uint64_t>::identity;
482+
NBL_CONSTEXPR_INLINE_VAR emulated_uint64_t minus_assign<emulated_uint64_t>::identity = minus<emulated_uint64_t>::identity;
483483
template<>
484-
NBL_CONSTEXPR emulated_int64_t minus_assign<emulated_int64_t>::identity = minus<emulated_int64_t>::identity;
484+
NBL_CONSTEXPR_INLINE_VAR emulated_int64_t minus_assign<emulated_int64_t>::identity = minus<emulated_int64_t>::identity;
485485

486486
// ------------------------------------------------ TYPE TRAITS SATISFIED -----------------------------------------------------
487487

0 commit comments

Comments
 (0)