Skip to content

Commit ff83045

Browse files
committed
usage changes to NBL_VALID_EXPRESSION macro
1 parent e810f47 commit ff83045

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

include/nbl/builtin/hlsl/concepts.hlsl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,18 @@ NBL_CONSTEXPR bool NBL_CONCEPT_NAME = BOOST_PP_SEQ_FOR_EACH_I(NBL_IMPL_CONCEPT_E
122122
#include <boost/preprocessor/comparison/not_equal.hpp>
123123
#include <boost/preprocessor/punctuation/comma_if.hpp>
124124

125-
#define NBL_IMPL_EXPR_DECLVAL(r,data,i,_T) BOOST_PP_COMMA_IF(BOOST_PP_NOT_EQUAL(i,0)) experimental::declval<_T>()
126125
#define NBL_IMPL_EXPR_DECL_TEMP_ARG(r,data,i,_T) BOOST_PP_COMMA_IF(BOOST_PP_NOT_EQUAL(i,0)) typename _T
127126
#define NBL_IMPL_EXPR_ITER_TEMP_ARG(r,data,i,_T) BOOST_PP_COMMA_IF(BOOST_PP_NOT_EQUAL(i,0)) _T
128-
#define NBL_VALID_EXPRESSION(CONCEPT_NAME, FUNCTION_NAME, ARG_TYPE_LIST, ARG_TYPE_SET)\
127+
#define NBL_VALID_EXPRESSION(CONCEPT_NAME, ARG_TYPE_LIST, ...)\
129128
namespace impl\
130129
{\
131130
template<BOOST_PP_SEQ_FOR_EACH_I(NBL_IMPL_EXPR_DECL_TEMP_ARG, _, ARG_TYPE_LIST), typename enable=void>\
132131
struct CONCEPT_NAME : false_type {};\
133132
template<BOOST_PP_SEQ_FOR_EACH_I(NBL_IMPL_EXPR_DECL_TEMP_ARG, _, ARG_TYPE_LIST)>\
134-
struct CONCEPT_NAME<BOOST_PP_SEQ_FOR_EACH_I(NBL_IMPL_EXPR_ITER_TEMP_ARG, _, ARG_TYPE_LIST), make_void_t<decltype(FUNCTION_NAME<BOOST_PP_SEQ_FOR_EACH_I(NBL_IMPL_EXPR_ITER_TEMP_ARG, _, ARG_TYPE_LIST)>(BOOST_PP_SEQ_FOR_EACH_I(NBL_IMPL_EXPR_DECLVAL, _, ARG_TYPE_SET)))> > : true_type {};\
133+
struct CONCEPT_NAME<BOOST_PP_SEQ_FOR_EACH_I(NBL_IMPL_EXPR_ITER_TEMP_ARG, _, ARG_TYPE_LIST), make_void_t<decltype( __VA_ARGS__ )> > : true_type {};\
135134
}\
136135
template<BOOST_PP_SEQ_FOR_EACH_I(NBL_IMPL_EXPR_DECL_TEMP_ARG, _, ARG_TYPE_LIST)>\
137-
NBL_BOOL_CONCEPT CONCEPT_NAME = impl::CONCEPT_NAME<BOOST_PP_SEQ_FOR_EACH_I(NBL_IMPL_EXPR_ITER_TEMP_ARG, _, ARG_TYPE_LIST)>::value;\
136+
NBL_BOOL_CONCEPT CONCEPT_NAME = impl::CONCEPT_NAME<BOOST_PP_SEQ_FOR_EACH_I(NBL_IMPL_EXPR_ITER_TEMP_ARG, _, ARG_TYPE_LIST)>::value\
138137

139138
}
140139
}

include/nbl/builtin/hlsl/spirv_intrinsics/core.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ template<typename T NBL_FUNC_REQUIRES(concepts::FloatingPoint<T> || concepts::Fl
356356
[[vk::ext_instruction(spv::OpFOrdEqual)]]
357357
conditional_t<is_vector_v<T>, vector<bool, vector_traits<T>::Dimension>, bool> FOrdEqual(T lhs, T rhs);
358358

359-
NBL_VALID_EXPRESSION(IEqualIsCallable, IEqual, (T), (T)(T))
360-
NBL_VALID_EXPRESSION(FOrdEqualIsCallable, FOrdEqual, (T), (T)(T))
359+
NBL_VALID_EXPRESSION(IEqualIsCallable, (T), IEqual<T>(experimental::declval<T>(),experimental::declval<T>()));
360+
NBL_VALID_EXPRESSION(FOrdEqualIsCallable, (T), FOrdEqual<T>(experimental::declval<T>(),experimental::declval<T>()));
361361

362362
template<typename T>
363363
NBL_BOOL_CONCEPT EqualIntrinsicCallable = IEqualIsCallable<T> || FOrdEqualIsCallable<T>;
@@ -366,7 +366,7 @@ template<typename T, typename U NBL_FUNC_REQUIRES(concepts::Boolean<U> && (!conc
366366
[[vk::ext_instruction(spv::OpSelect)]]
367367
T select(U a, T x, T y);
368368

369-
NBL_VALID_EXPRESSION(SelectIsCallable, select, (T)(U), (U)(T)(T))
369+
NBL_VALID_EXPRESSION(SelectIsCallable, (T)(U), select<T,U>(experimental::declval<U>(),experimental::declval<T>(),experimental::declval<T>()));
370370

371371
}
372372

0 commit comments

Comments
 (0)