Adaptive Game Math Library
What does it do?




           Something... I hope... Maybe?
Progress!
New Organization and Streamlined API
                       API                                   Tool Chain
              High Level Interface                       Build system
Bulk Matrix Container             Matrix Stack            Makefile
Bulk Matrix Stack                 Dynamic Vector          Code::Blocks Project
                                                          Visual Studio Project
                       Core
                                                        Testing Framework
Vector           Bulk Operations         Allocators
                                                          Automated Testing
Matrix           Approximations          Probability      Code Coverage
                    Basics                              Timing Framework
Fixed-width Scalar Types         Complex Types            User-Friendly GUI
                                                          Core Components
         Compatibility Layers and non User Facing Code
         Intrinsic Compatibility Layer                 Universal SIMD Types
New Functionality
What's Done?
       Gratuitous use of graphics

Matrix/Vector Implementations


   4x4, f32 Specialization


       Complex Types


    Universal SIMD Type
What's In Progress?

    Bulk Operations

    Approximations

      Allocators

      Probability

   Dynamic Vectors
Timing Framework
Performance
void Rotate(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {
    M3DMatrix44f mTemp, mRotate;
    m3dRotationMatrix44(mRotate, float(m3dDegToRad(angle)), x, y, z);
    m3dCopyMatrix44(mTemp, pStack[stackPointer]);
    m3dMatrixMultiply44(pStack[stackPointer], mTemp, mRotate);
}

void rot(f32 x, f32 y, f32 z) {                                  t1 = _mm_mul_ps(simd[0],t);
           f32 b = cos(x), a = sin(x), d = cos(y), c = sin(y),   H = -a*d;
                  f = cos(z), e = sin(z);                        t = _mm_set1_ps(E);
           f32 cf = c*f, ae = a*e, be = b*e;                     t1 = _mm_add_ps(_mm_mul_ps(simd[1],t),t1
           f32 A,B,C,D,E,F,H,I;                                  C = ae-b*cf;
           _v128 t0, t1, t2;                                     t = _mm_set1_ps(H);
           _v128 t;                                              t1 = _mm_add_ps(_mm_mul_ps(simd[2],t),t1
           A = d*f;                                              F = be*c;
           t = _mm_set1_ps(A);                                   t = _mm_set1_ps(C);
           D = -d*e;                                             t2 = _mm_mul_ps(simd[0],t);
           t0 = _mm_mul_ps(simd[0],t);                           F+= a*f;
           t = _mm_set1_ps(D);                                   t = _mm_set1_ps(F);
           B = a*cf;                                             t2 = _mm_add_ps(_mm_mul_ps(simd[1],t),t2
           t0 = _mm_add_ps(_mm_mul_ps(simd[1],t),t0);            I = b*d;
           t = _mm_set1_ps(c);                                   t = _mm_set1_ps(I);
           E = b*f;                                              t2 = _mm_add_ps(_mm_mul_ps(simd[2],t),t2
           t0 = _mm_add_ps(_mm_mul_ps(simd[2],t),t0);            simd[0] = t0;
           E -= ae*c;                                            simd[1] = t1;
           t = _mm_set1_ps(B);                                   simd[2] = t2;
           B += be;                                        }
Testing

●   Framework


Automation
●




●   Coverage
Intrinsic Framework
                            API Functions



                       Generic SIMD Execution
                                Layer



                       Compile-time Decisions




 Inline Assembly and C
                                Compiler        Conversions between
Implementations for non-
                           Intrinsic Support     SIMD architectures
conforming Environments
Future Directions
ARM Port
Bulk Matrix Containers and Matrix
             Stacks
Examples and Tutorials
Thank You!

8.7.2011 agml

  • 1.
  • 2.
    What does itdo? Something... I hope... Maybe?
  • 3.
  • 4.
    New Organization andStreamlined API API Tool Chain High Level Interface Build system Bulk Matrix Container Matrix Stack Makefile Bulk Matrix Stack Dynamic Vector Code::Blocks Project Visual Studio Project Core Testing Framework Vector Bulk Operations Allocators Automated Testing Matrix Approximations Probability Code Coverage Basics Timing Framework Fixed-width Scalar Types Complex Types User-Friendly GUI Core Components Compatibility Layers and non User Facing Code Intrinsic Compatibility Layer Universal SIMD Types
  • 5.
  • 6.
    What's Done? Gratuitous use of graphics Matrix/Vector Implementations 4x4, f32 Specialization Complex Types Universal SIMD Type
  • 7.
    What's In Progress? Bulk Operations Approximations Allocators Probability Dynamic Vectors
  • 8.
  • 9.
  • 10.
    void Rotate(GLfloat angle,GLfloat x, GLfloat y, GLfloat z) { M3DMatrix44f mTemp, mRotate; m3dRotationMatrix44(mRotate, float(m3dDegToRad(angle)), x, y, z); m3dCopyMatrix44(mTemp, pStack[stackPointer]); m3dMatrixMultiply44(pStack[stackPointer], mTemp, mRotate); } void rot(f32 x, f32 y, f32 z) { t1 = _mm_mul_ps(simd[0],t); f32 b = cos(x), a = sin(x), d = cos(y), c = sin(y), H = -a*d; f = cos(z), e = sin(z); t = _mm_set1_ps(E); f32 cf = c*f, ae = a*e, be = b*e; t1 = _mm_add_ps(_mm_mul_ps(simd[1],t),t1 f32 A,B,C,D,E,F,H,I; C = ae-b*cf; _v128 t0, t1, t2; t = _mm_set1_ps(H); _v128 t; t1 = _mm_add_ps(_mm_mul_ps(simd[2],t),t1 A = d*f; F = be*c; t = _mm_set1_ps(A); t = _mm_set1_ps(C); D = -d*e; t2 = _mm_mul_ps(simd[0],t); t0 = _mm_mul_ps(simd[0],t); F+= a*f; t = _mm_set1_ps(D); t = _mm_set1_ps(F); B = a*cf; t2 = _mm_add_ps(_mm_mul_ps(simd[1],t),t2 t0 = _mm_add_ps(_mm_mul_ps(simd[1],t),t0); I = b*d; t = _mm_set1_ps(c); t = _mm_set1_ps(I); E = b*f; t2 = _mm_add_ps(_mm_mul_ps(simd[2],t),t2 t0 = _mm_add_ps(_mm_mul_ps(simd[2],t),t0); simd[0] = t0; E -= ae*c; simd[1] = t1; t = _mm_set1_ps(B); simd[2] = t2; B += be; }
  • 11.
    Testing ● Framework Automation ● ● Coverage
  • 12.
    Intrinsic Framework API Functions Generic SIMD Execution Layer Compile-time Decisions Inline Assembly and C Compiler Conversions between Implementations for non- Intrinsic Support SIMD architectures conforming Environments
  • 13.
  • 14.
  • 15.
    Bulk Matrix Containersand Matrix Stacks
  • 16.
  • 17.