DESIRE-Engine/src/Engine/Core/Math/SIMD.h
// Blend (select) elements from a and b using the mask
Blend (select) elements from a and b using the mask
Blend ( select ) elements from a and b using the mask
static inline simd128_t Blend(simd128_t a, simd128_t b, simd128_t mask)
	{
#if DESIRE_USE_SSE
		return _mm_blendv_ps(a, b, mask);
#elif DESIRE_USE_NEON
		return vbslq_f32(reinterpret_cast<uint32x4_t>(mask), b, a);
#else
		return simd128_t(
			(mask.u32[0] & b.u32[0]) | (~mask.u32[0] & a.u32[0]),
			(mask.u32[1] & b.u32[1]) | (~mask.u32[1] & a.u32[1]),
			(mask.u32[2] & b.u32[2]) | (~mask.u32[2] & a.u32[2]),
			(mask.u32[3] & b.u32[3]) | (~mask.u32[3] & a.u32[3])
		);
#endif
	}
static inline simd128_t Blend ( simd128_t a , simd128_t b , simd128_t mask ) { #if DESIRE_USE_SSE return _mm_blendv_ps ( a , b , mask ) ; #elif DESIRE_USE_NEON return vbslq_f32 ( reinterpret_cast < uint32x4_t > ( mask ) , b , a ) ; #else return simd128_t ( ( mask . u32 [ 0 ] & b . u32 [ 0 ] ) | ( ~ mask . u32 [ 0 ] & a . u32 [ 0 ] ) , ( mask . u32 [ 1 ] & b . u32 [ 1 ] ) | ( ~ mask . u32 [ 1 ] & a . u32 [ 1 ] ) , ( mask . u32 [ 2 ] & b . u32 [ 2 ] ) | ( ~ mask . u32 [ 2 ] & a . u32 [ 2 ] ) , ( mask . u32 [ 3 ] & b . u32 [ 3 ] ) | ( ~ mask . u32 [ 3 ] & a . u32 [ 3 ] ) ) ; #endif }
Blend (select) elements from a and b using the mask
Blend ( select ) elements from a and b using the mask