mirror of
https://github.com/g-truc/glm.git
synced 2024-11-29 19:34:36 +00:00
simd constexpr vec: introduce new function compWiseTernary for bvec, for simd select from mask
This commit is contained in:
parent
c5c4b90be8
commit
4f5d589ecc
@ -184,6 +184,14 @@ namespace glm
|
|||||||
return a[i];
|
return a[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Tx, typename Qx> requires(std::is_same_v<T, bool>)
|
||||||
|
inline vec<L, Tx, Qx> compWiseTernary(vec<L, Tx, Qx> v1, vec<L, Tx, Qx> v2) {
|
||||||
|
GccVec_t condMask = std::bit_cast<GccVec_t>(elementArr);
|
||||||
|
auto gv1 = std::bit_cast<GccVec<L, Tx, Qx>>(v1.elementArr);
|
||||||
|
auto gv2 = std::bit_cast<GccVec<L, Tx, Qx>>(v2.elementArr);
|
||||||
|
return vec<L, Tx, Qx>(std::bit_cast<detail::_data_t<L, Tx, Qx>> ((condMask ? gv1 : gv2)));
|
||||||
|
}
|
||||||
|
|
||||||
template <typename ScalarGetter>
|
template <typename ScalarGetter>
|
||||||
static constexpr auto ctor_scalar(ScalarGetter scalar) {
|
static constexpr auto ctor_scalar(ScalarGetter scalar) {
|
||||||
if (std::is_constant_evaluated()) {
|
if (std::is_constant_evaluated()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user