@@ -240,13 +240,17 @@ struct mix_helper<T, T NBL_PARTIAL_REQ_BOT(always_true<decltype(spirv::fMix<T>(e
240
240
}
241
241
};
242
242
243
- template<typename T> NBL_PARTIAL_REQ_TOP (concepts::FloatingPointScalar<T>)
244
- struct mix_helper<T, bool NBL_PARTIAL_REQ_BOT (concepts::FloatingPointScalar<T>) >
243
+ template<typename T, typename U>
244
+ NBL_PARTIAL_REQ_TOP ((concepts::Scalar<T> || concepts::Vectorial<T>) && !concepts::Boolean<T> && concepts::Boolean<U>)
245
+ struct mix_helper<T, U NBL_PARTIAL_REQ_BOT ((concepts::Scalar<T> || concepts::Vectorial<T>) && !concepts::Boolean<T> && concepts::Boolean<U>) >
245
246
{
246
247
using return_t = conditional_t<is_vector_v<T>, vector <typename vector_traits<T>::scalar_type, vector_traits<T>::Dimension>, T>;
247
- static inline return_t __call (const T x, const T y, const bool a)
248
+ // for a component of a that is false, the corresponding component of x is returned
249
+ // for a component of a that is true, the corresponding component of y is returned
250
+ // so we make sure this is correct when calling the operation
251
+ static inline return_t __call (const T x, const T y, const U a)
248
252
{
249
- return a ? x : y ;
253
+ return spirv::select<T, U>(a, y, x) ;
250
254
}
251
255
};
252
256
@@ -862,8 +866,8 @@ struct mix_helper<T, T NBL_PARTIAL_REQ_BOT(VECTOR_SPECIALIZATION_CONCEPT) >
862
866
};
863
867
864
868
template<typename T, typename U>
865
- NBL_PARTIAL_REQ_TOP (concepts::Vectorial<T> && concepts::Boolean<U> && vector_traits<T>::Dimension == vector_traits<U>::Dimension)
866
- struct mix_helper<T, U NBL_PARTIAL_REQ_BOT (concepts::Vectorial<T> && concepts::Boolean<U> && vector_traits<T>::Dimension == vector_traits<U>::Dimension) >
869
+ NBL_PARTIAL_REQ_TOP (VECTOR_SPECIALIZATION_CONCEPT && concepts::Boolean<U> && vector_traits<T>::Dimension == vector_traits<U>::Dimension)
870
+ struct mix_helper<T, U NBL_PARTIAL_REQ_BOT (VECTOR_SPECIALIZATION_CONCEPT && concepts::Boolean<U> && vector_traits<T>::Dimension == vector_traits<U>::Dimension) >
867
871
{
868
872
using return_t = T;
869
873
static return_t __call (NBL_CONST_REF_ARG (T) x, NBL_CONST_REF_ARG (T) y, NBL_CONST_REF_ARG (U) a)
0 commit comments