cgmath
cgmath copied to clipboard
SIMD support
This is a huge task, but I think the long term benefits are worth it. It would be helpful if we added some simd support for some operators.
We can split up BaseFloat to ScalarFloat and SIMDFloat (Suggestions for better names?). SIMDFloat is a subset of Float of primitives that can map to a vector of elements. The idea is not that we try and use a f32x4 to represent a single Vector4, but rather to create Vector4<f32x4>. This would mean you are operating on four vector4's at a time.
Benefits:
- Ability to accelerate cgmath using simd
Cons:
- Complexity will increase, Some traits might need to be split up because only a subset of the API can be used in a SIMD like way
- We will also need to maintain an additional SIMD float type.
Thoughts?
Why is Vector4<f32x4> so important exactly?
Overall, I'm all for it. Great :+1: !
Having nalgebra as a strict mathematical alternative, I see cgmath story as being more close to the metal and our graphics needs, if it wants to survive and prosper. Having SIMD support is going exactly into this direction, so this should be a strategic goal.
As for the implementation details, I don't know much enough about SIMD to comment. Will look at it ;)
@kvark I ended up creating a similar type in one of my projects to use SIMD vectors when I realized cgmath probably could do this natively with a little bit of work.