| |
|
|
||||
![]() |
||||||
| |
|
|||||
|
The Library Using the Streaming SIMD Extensions, you can complete a matrix multiplication with only 16 products and 12 additions. The library provided in this article was written with the goal to get the most out of the Streaming SIMD Extensions, and to reduce the amount of time needed for matrix/vector operations. Most of the library is written in C++, except for one small section in assembly. The library’s functions are about twice as fast as the equivalent scalar version of those functions.The library includes three classes: GPMatrix class The GPMatrix class is a 4x4 matrix of floats.
The class contains 16 float elements (_11 to _44). The elements are
placed in four lines, where each line is represented as one SIMD variable
(_L1 to _L1). There
is one limitation for the use of this class: The
GPVector class
The GPVector class has the x,y,z and w elements of the vector as floats, and also represented as one SIMD variable. As with the GPMatrix class, the GPVector class must be 16-bytes aligned. A variant of the GPVector class is the GPVector3 class, which does not have the w element. This class holds "pure" 3D vectors. However, for alignment and for other reasons, the w element, which is not used, is replaced with a spacer. Constructors & Operators Operators on GPMatrix: GPMatrix Constructors: Operators on GPVector:
________________________________________________________ |
|
|