3D Math Data structures/SIMD
Lukas Pinkowski
Lukas.Pinkowski at web.de
Fri Dec 21 02:36:10 PST 2007
I'm wondering why the 2D/3D/4D-vector and -matrix data types don't find
their way into the mainstream programming languages as builtin types?
The only that I know of that have builtin-support are the shader languages
(HLSL, GLSL, Cg, ...) and I suppose the VectorC/C++-compiler. Instead the
vector- and matrix-class is coded over and over again, with different
3D-libraries using their own implementation/interface.
SIMD instructions are pretty 'old' now, but the compilers support them only
through non-portable extensions, or handwritten assembly.
I think the programming language of the future should have those builtin
instead of in myriads of libraries.
It would be nice if one of the Open Source D-compilers (GDC, LLVMDC) would
implement such an extension to D in an experimental branch; don't know if
it's easy to generate SIMD-code with the GCC backend, but LLVM is supposed
to make it easy, right?
Hopefully this extension could propagate after some time into the official D
spec. Even if Walter won't touch the backend again, DMD could at least
provide a software implementation (like for 64bit integer operations).
Seeing that D seems to be quite popular for game programming and numerics,
this would be a nice addition.
Well, as for the typenames, I guess something along
v2f, v3f, v4f, m2f, m3f, m4f: vectors and matrices based on float
v2d, v3d, v4d, m2d, m3d, m4d: vectors and matrices based on double
v2r, v3r, v4r, m2r, m3r, m4r: vectors and matrices based on real
Or vec2f instead of v2f, mat2f instead of m2f, a.s.o. Complex versions would
be probably needed, too?
More information about the Digitalmars-d
mailing list