When you use the simd classes like float3/matrix3x3 on Swift they are great. I can write and run code like this from existing math routines that are readily found on the web.
When you try to do this in C++/ObjC, the code becomes this. This is not code readily found on the web, and is a big pain to convert.
Can the float3x3 and other wrappers to simd_float3x3 provide an operator[] to the column and other operations like splatting since v[0] above pulls the data out of simd registers.
We currently have to derive off the matrix classes, but it seems like functionality that should be provided in the C/C++ simd classes. A vector math library should promote better code readability than this. We seem to not be able to derive off the vector types which is an issue below.
I also have code based on classes that takes 3 elements that suddenly has to convert to this less readble form.
And then there's this code that should fill all values like init repeating in Swift. This is error prone in converting existing simd code to Accelerate simd. So then we try to wrap the float3, can't derive off them, and then lose all swizzling support, operators, etc. Then have to roll our own ops on that struct that holds a float3. What's the recommended way to make this more C++ like without more compiler support
Code Block let value = m[0][0] * v[0]
When you try to do this in C++/ObjC, the code becomes this. This is not code readily found on the web, and is a big pain to convert.
Code Block float value = m.columns[0][0] * v[0];
Can the float3x3 and other wrappers to simd_float3x3 provide an operator[] to the column and other operations like splatting since v[0] above pulls the data out of simd registers.
We currently have to derive off the matrix classes, but it seems like functionality that should be provided in the C/C++ simd classes. A vector math library should promote better code readability than this. We seem to not be able to derive off the vector types which is an issue below.
I also have code based on classes that takes 3 elements that suddenly has to convert to this less readble form.
Code Block float3 v(x,y,z) -> float3 v(simd_make_float3(x,y,z))
And then there's this code that should fill all values like init repeating in Swift. This is error prone in converting existing simd code to Accelerate simd. So then we try to wrap the float3, can't derive off them, and then lose all swizzling support, operators, etc. Then have to roll our own ops on that struct that holds a float3. What's the recommended way to make this more C++ like without more compiler support
Code Block float3 v = {3} -> 3,0,0 < wasn't expecting that float3 v(3) < doesn't compile v = {3,0,0} is completely different syntax, and doesn't line up with MSL and most simd libraries struct myfloat3 : float3 < doesn't work struct myfloat3 { float3 v; <- works, but loses swizzles, operators, etc explicit myfloat3(float value) myfloat3(float x, float y, float z) ... }