[QUESTION][struct_support] load struct #1893
-
Hello!
I need to load some data from float* to vec3. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi. So - bad news - if you want it like this, it's not supported very well.
We recommend using SoA for simd.
If you want to use If you do the same operation for all of them - just cast to float*. If you want to build The easiest way to do it is with gather BUT IT'S BAD:
You can also try to shuffle registers together but it's hard. You can try your luck with __builtin_shufflevector from clang/gcc. |
Beta Was this translation helpful? Give feedback.
Hi.
So - bad news - if you want it like this, it's not supported very well.
We recommend using SoA for simd.
If you can, use eve::algo::soa_vector
https://jfalcou.github.io/eve/structeve_1_1algo_1_1soa__vector.html#a1cfd01b1cec55dd3fab8e0c6809764f4
And then all the algorithms and everything will work.
If you want to use
std::vector<vec3>
that's going to be quite slow.We also don't have amazing support for it.
If you do the same operation for all of them - just cast to float*.
You can also do some masking, but since it's
vec3
it won't be easy and you can't just use existing algorithm.If you want to build
wide<vec3>
- you'd need to deinterleave the dat…