180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2011 Google Inc.
480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be
680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file.
780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkBenchmark.h"
980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkMatrix.h"
1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkRandom.h"
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkString.h"
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass MatrixBench : public SkBenchmark {
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkString    fName;
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    enum { N = 100000 };
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    MatrixBench(void* param, const char name[]) : INHERITED(param) {
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fName.printf("matrix_%s", name);
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fIsRendering = false;
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void performTest() = 0;
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual int mulLoopCount() const { return 1; }
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual const char* onGetName() {
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        return fName.c_str();
2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
31096defe64d408e54474fe19f418c95bf1a554fc7Derek Sollenberger    virtual void onDraw(SkCanvas*) {
3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        int n = SkBENCHLOOP(N * this->mulLoopCount());
3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        for (int i = 0; i < n; i++) {
3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            this->performTest();
3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef SkBenchmark INHERITED;
4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// we want to stop the compiler from eliminating code that it thinks is a no-op
4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// so we have a non-static global we increment, hoping that will convince the
4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// compiler to execute everything
4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruint gMatrixBench_NonStaticGlobal;
4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define always_do(pred)                     \
4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    do {                                    \
4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (pred) {                         \
5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            ++gMatrixBench_NonStaticGlobal; \
5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }                                   \
5280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    } while (0)
5380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
5480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass EqualsMatrixBench : public MatrixBench {
5580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
5680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    EqualsMatrixBench(void* param) : INHERITED(param, "equals") {}
5780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
5880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void performTest() {
5980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkMatrix m0, m1, m2;
6080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
6180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        m0.reset();
6280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        m1.reset();
6380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        m2.reset();
6480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        always_do(m0 == m1);
6580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        always_do(m1 == m2);
6680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        always_do(m2 == m0);
6780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
6880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
6980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef MatrixBench INHERITED;
7080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
7180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
7280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass ScaleMatrixBench : public MatrixBench {
7380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
7480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    ScaleMatrixBench(void* param) : INHERITED(param, "scale") {
7580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fSX = fSY = SkFloatToScalar(1.5f);
7680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fM0.reset();
7780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fM1.setScale(fSX, fSY);
7880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fM2.setTranslate(fSX, fSY);
7980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
8080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
8180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void performTest() {
8280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkMatrix m;
8380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        m = fM0; m.preScale(fSX, fSY);
8480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        m = fM1; m.preScale(fSX, fSY);
8580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        m = fM2; m.preScale(fSX, fSY);
8680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
8780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
8880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkMatrix fM0, fM1, fM2;
8980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkScalar fSX, fSY;
9080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef MatrixBench INHERITED;
9180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
9280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
9380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// having unknown values in our arrays can throw off the timing a lot, perhaps
9480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// handling NaN values is a lot slower. Anyway, this guy is just meant to put
9580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// reasonable values in our arrays.
9680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querutemplate <typename T> void init9(T array[9]) {
9780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkRandom rand;
9880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    for (int i = 0; i < 9; i++) {
9980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        array[i] = rand.nextSScalar1();
10080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
10180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}
10280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
10380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// Test the performance of setConcat() non-perspective case:
10480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// using floating point precision only.
10580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass FloatConcatMatrixBench : public MatrixBench {
10680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
10780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    FloatConcatMatrixBench(void* p) : INHERITED(p, "concat_floatfloat") {
10880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        init9(mya);
10980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        init9(myb);
11080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        init9(myr);
11180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
11280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
11380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual int mulLoopCount() const { return 4; }
11480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
11580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static inline void muladdmul(float a, float b, float c, float d,
11680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                                   float* result) {
11780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru      *result = a * b + c * d;
11880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
11980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void performTest() {
12080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        const float* a = mya;
12180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        const float* b = myb;
12280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float* r = myr;
12380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[0], b[0], a[1], b[3], &r[0]);
12480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[0], b[1], a[1], b[4], &r[1]);
12580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[0], b[2], a[1], b[5], &r[2]);
12680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        r[2] += a[2];
12780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[3], b[0], a[4], b[3], &r[3]);
12880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[3], b[1], a[4], b[4], &r[4]);
12980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[3], b[2], a[4], b[5], &r[5]);
13080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        r[5] += a[5];
13180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        r[6] = r[7] = 0.0f;
13280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        r[8] = 1.0f;
13380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
13480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
13580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    float mya [9];
13680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    float myb [9];
13780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    float myr [9];
13880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef MatrixBench INHERITED;
13980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
14080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
14180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic inline float SkDoubleToFloat(double x) {
14280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    return static_cast<float>(x);
14380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}
14480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
14580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// Test the performance of setConcat() non-perspective case:
14680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// using floating point precision but casting up to float for
14780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// intermediate results during computations.
14880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass FloatDoubleConcatMatrixBench : public MatrixBench {
14980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
15080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    FloatDoubleConcatMatrixBench(void* p) : INHERITED(p, "concat_floatdouble") {
15180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        init9(mya);
15280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        init9(myb);
15380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        init9(myr);
15480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
15580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
15680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual int mulLoopCount() const { return 4; }
15780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
15880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static inline void muladdmul(float a, float b, float c, float d,
15980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                                   float* result) {
16080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru      *result = SkDoubleToFloat((double)a * b + (double)c * d);
16180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
16280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void performTest() {
16380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        const float* a = mya;
16480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        const float* b = myb;
16580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float* r = myr;
16680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[0], b[0], a[1], b[3], &r[0]);
16780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[0], b[1], a[1], b[4], &r[1]);
16880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[0], b[2], a[1], b[5], &r[2]);
16980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        r[2] += a[2];
17080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[3], b[0], a[4], b[3], &r[3]);
17180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[3], b[1], a[4], b[4], &r[4]);
17280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[3], b[2], a[4], b[5], &r[5]);
17380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        r[5] += a[5];
17480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        r[6] = r[7] = 0.0f;
17580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        r[8] = 1.0f;
17680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
17780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
17880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    float mya [9];
17980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    float myb [9];
18080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    float myr [9];
18180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef MatrixBench INHERITED;
18280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
18380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
18480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// Test the performance of setConcat() non-perspective case:
18580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// using double precision only.
18680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass DoubleConcatMatrixBench : public MatrixBench {
18780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
18880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    DoubleConcatMatrixBench(void* p) : INHERITED(p, "concat_double") {
18980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        init9(mya);
19080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        init9(myb);
19180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        init9(myr);
19280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
19380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
19480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual int mulLoopCount() const { return 4; }
19580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
19680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static inline void muladdmul(double a, double b, double c, double d,
19780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                                   double* result) {
19880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru      *result = a * b + c * d;
19980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
20080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void performTest() {
20180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        const double* a = mya;
20280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        const double* b = myb;
20380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        double* r = myr;
20480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[0], b[0], a[1], b[3], &r[0]);
20580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[0], b[1], a[1], b[4], &r[1]);
20680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[0], b[2], a[1], b[5], &r[2]);
20780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        r[2] += a[2];
20880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[3], b[0], a[4], b[3], &r[3]);
20980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[3], b[1], a[4], b[4], &r[4]);
21080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        muladdmul(a[3], b[2], a[4], b[5], &r[5]);
21180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        r[5] += a[5];
21280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        r[6] = r[7] = 0.0;
21380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        r[8] = 1.0;
21480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
21580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
21680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    double mya [9];
21780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    double myb [9];
21880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    double myr [9];
21980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef MatrixBench INHERITED;
22080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
22180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
22280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass GetTypeMatrixBench : public MatrixBench {
22380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
22480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    GetTypeMatrixBench(void* param)
22580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        : INHERITED(param, "gettype") {
22680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fArray[0] = (float) fRnd.nextS();
22780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fArray[1] = (float) fRnd.nextS();
22880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fArray[2] = (float) fRnd.nextS();
22980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fArray[3] = (float) fRnd.nextS();
23080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fArray[4] = (float) fRnd.nextS();
23180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fArray[5] = (float) fRnd.nextS();
23280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fArray[6] = (float) fRnd.nextS();
23380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fArray[7] = (float) fRnd.nextS();
23480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fArray[8] = (float) fRnd.nextS();
23580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
23680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
23780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    // Putting random generation of the matrix inside performTest()
23880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    // would help us avoid anomalous runs, but takes up 25% or
23980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    // more of the function time.
24080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void performTest() {
24180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fMatrix.setAll(fArray[0], fArray[1], fArray[2],
24280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                       fArray[3], fArray[4], fArray[5],
24380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                       fArray[6], fArray[7], fArray[8]);
24480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        always_do(fMatrix.getType());
24580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fMatrix.dirtyMatrixTypeCache();
24680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        always_do(fMatrix.getType());
24780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fMatrix.dirtyMatrixTypeCache();
24880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        always_do(fMatrix.getType());
24980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fMatrix.dirtyMatrixTypeCache();
25080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        always_do(fMatrix.getType());
25180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fMatrix.dirtyMatrixTypeCache();
25280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        always_do(fMatrix.getType());
25380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fMatrix.dirtyMatrixTypeCache();
25480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        always_do(fMatrix.getType());
25580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fMatrix.dirtyMatrixTypeCache();
25680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        always_do(fMatrix.getType());
25780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fMatrix.dirtyMatrixTypeCache();
25880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        always_do(fMatrix.getType());
25980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
26080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
26180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkMatrix fMatrix;
26280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    float fArray[9];
26380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkRandom fRnd;
26480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef MatrixBench INHERITED;
26580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
26680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
26780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass ScaleTransMixedMatrixBench : public MatrixBench {
26880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru public:
2697839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger    ScaleTransMixedMatrixBench(void* p) : INHERITED(p, "scaletrans_mixed") {
27080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fMatrix.setAll(fRandom.nextSScalar1(), fRandom.nextSScalar1(), fRandom.nextSScalar1(),
27180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                       fRandom.nextSScalar1(), fRandom.nextSScalar1(), fRandom.nextSScalar1(),
27280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                       fRandom.nextSScalar1(), fRandom.nextSScalar1(), fRandom.nextSScalar1());
27380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        int i;
2747839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger        for (i = 0; i < kCount; i++) {
27580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fSrc[i].fX = fRandom.nextSScalar1();
27680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fSrc[i].fY = fRandom.nextSScalar1();
27780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fDst[i].fX = fRandom.nextSScalar1();
27880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fDst[i].fY = fRandom.nextSScalar1();
27980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
28080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
28180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru protected:
28280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void performTest() {
28380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkPoint* dst = fDst;
28480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        const SkPoint* src = fSrc;
2857839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger        int count = kCount;
28680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float mx = fMatrix[SkMatrix::kMScaleX];
28780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float my = fMatrix[SkMatrix::kMScaleY];
28880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float tx = fMatrix[SkMatrix::kMTransX];
28980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float ty = fMatrix[SkMatrix::kMTransY];
29080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        do {
29180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            dst->fY = SkScalarMulAdd(src->fY, my, ty);
29280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            dst->fX = SkScalarMulAdd(src->fX, mx, tx);
29380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            src += 1;
29480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            dst += 1;
29580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        } while (--count);
29680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
29780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru private:
2987839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger    enum {
2997839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger        kCount = SkBENCHLOOP(16)
3007839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger    };
30180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkMatrix fMatrix;
30280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkPoint fSrc [16];
30380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkPoint fDst [16];
30480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkRandom fRandom;
30580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef MatrixBench INHERITED;
30680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
30780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
30880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass ScaleTransDoubleMatrixBench : public MatrixBench {
30980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru public:
3107839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger    ScaleTransDoubleMatrixBench(void* p) : INHERITED(p, "scaletrans_double") {
31180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        init9(fMatrix);
31280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        int i;
3137839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger        for (i = 0; i < kCount; i++) {
31480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fSrc[i].fX = fRandom.nextSScalar1();
31580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fSrc[i].fY = fRandom.nextSScalar1();
31680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fDst[i].fX = fRandom.nextSScalar1();
31780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fDst[i].fY = fRandom.nextSScalar1();
31880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
31980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
32080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru protected:
32180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void performTest() {
32280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkPoint* dst = fDst;
32380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        const SkPoint* src = fSrc;
3247839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger        int count = kCount;
32580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        // As doubles, on Z600 Linux systems this is 2.5x as expensive as mixed mode
32680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float mx = (float) fMatrix[SkMatrix::kMScaleX];
32780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float my = (float) fMatrix[SkMatrix::kMScaleY];
32880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float tx = (float) fMatrix[SkMatrix::kMTransX];
32980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float ty = (float) fMatrix[SkMatrix::kMTransY];
33080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        do {
33180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            dst->fY = src->fY * my + ty;
33280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            dst->fX = src->fX * mx + tx;
33380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            src += 1;
33480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            dst += 1;
33580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        } while (--count);
33680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
33780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru private:
3387839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger    enum {
3397839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger        kCount = SkBENCHLOOP(16)
3407839ce1af63bf12fe7b3caa866970bbbb3afb13dDerek Sollenberger    };
34180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    double fMatrix [9];
34280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkPoint fSrc [16];
34380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkPoint fDst [16];
34480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkRandom fRandom;
34580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef MatrixBench INHERITED;
34680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
34780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
34880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass InvertMapRectMatrixBench : public MatrixBench {
34980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
35080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    InvertMapRectMatrixBench(void* param, const char* name, int flags)
35180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        : INHERITED(param, name)
35280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        , fFlags(flags) {
35380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fMatrix.reset();
35480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fIteration = 0;
35580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (flags & kScale_Flag) {
35680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.postScale(SkFloatToScalar(1.5f), SkFloatToScalar(2.5f));
35780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
35880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (flags & kTranslate_Flag) {
35980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.postTranslate(SkFloatToScalar(1.5f), SkFloatToScalar(2.5f));
36080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
36180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (flags & kRotate_Flag) {
36280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.postRotate(SkFloatToScalar(45.0f));
36380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
36480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (flags & kPerspective_Flag) {
36580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.setPerspX(SkFloatToScalar(1.5f));
36680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.setPerspY(SkFloatToScalar(2.5f));
36780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
36880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (0 == (flags & kUncachedTypeMask_Flag)) {
36980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.getType();
37080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
37180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
37280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    enum Flag {
37380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kScale_Flag             = 0x01,
37480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kTranslate_Flag         = 0x02,
37580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kRotate_Flag            = 0x04,
37680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kPerspective_Flag       = 0x08,
37780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kUncachedTypeMask_Flag  = 0x10,
37880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    };
37980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
38080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void performTest() {
38180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (fFlags & kUncachedTypeMask_Flag) {
38280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            // This will invalidate the typemask without
38380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            // changing the matrix.
38480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.setPerspX(fMatrix.getPerspX());
38580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
38680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkMatrix inv;
38780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        bool invertible = fMatrix.invert(&inv);
38880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkASSERT(invertible);
38980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkRect transformedRect;
39080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        // an arbitrary, small, non-zero rect to transform
39180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkRect srcRect = SkRect::MakeWH(SkIntToScalar(10), SkIntToScalar(10));
39280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (invertible) {
39380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            inv.mapRect(&transformedRect, srcRect);
39480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
39580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
39680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
39780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkMatrix fMatrix;
39880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    int fFlags;
39980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    unsigned fIteration;
40080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef MatrixBench INHERITED;
40180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
40280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
403d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger///////////////////////////////////////////////////////////////////////////////
40480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
405d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH( return new EqualsMatrixBench(p); )
406d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH( return new ScaleMatrixBench(p); )
407d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH( return new FloatConcatMatrixBench(p); )
408d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH( return new FloatDoubleConcatMatrixBench(p); )
409d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH( return new DoubleConcatMatrixBench(p); )
410d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH( return new GetTypeMatrixBench(p); )
411d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH( return new InvertMapRectMatrixBench(p, "invert_maprect_identity", 0); )
41280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
413d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH(return new InvertMapRectMatrixBench(p,
414d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                                  "invert_maprect_rectstaysrect",
415d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                                  InvertMapRectMatrixBench::kScale_Flag |
416d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                                  InvertMapRectMatrixBench::kTranslate_Flag); )
41780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
418d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH(return new InvertMapRectMatrixBench(p,
419d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                                  "invert_maprect_translate",
420d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                                  InvertMapRectMatrixBench::kTranslate_Flag); )
421d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger
422d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH(return new InvertMapRectMatrixBench(p,
423d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                                  "invert_maprect_nonpersp",
424d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                                  InvertMapRectMatrixBench::kScale_Flag |
425d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                                  InvertMapRectMatrixBench::kRotate_Flag |
426d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                                  InvertMapRectMatrixBench::kTranslate_Flag); )
427d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger
428d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH( return new InvertMapRectMatrixBench(p,
429d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                               "invert_maprect_persp",
430d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                               InvertMapRectMatrixBench::kPerspective_Flag); )
431d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger
432d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH( return new InvertMapRectMatrixBench(p,
433d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                           "invert_maprect_typemask_rectstaysrect",
434d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                           InvertMapRectMatrixBench::kUncachedTypeMask_Flag |
435d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                           InvertMapRectMatrixBench::kScale_Flag |
436d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                           InvertMapRectMatrixBench::kTranslate_Flag); )
437d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger
438d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH( return new InvertMapRectMatrixBench(p,
439d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                           "invert_maprect_typemask_nonpersp",
440d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                           InvertMapRectMatrixBench::kUncachedTypeMask_Flag |
441d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                           InvertMapRectMatrixBench::kScale_Flag |
442d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                           InvertMapRectMatrixBench::kRotate_Flag |
443d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek Sollenberger                           InvertMapRectMatrixBench::kTranslate_Flag); )
44480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
445d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH( return new ScaleTransMixedMatrixBench(p); )
446d686ac77c2c485c4a3302eda9c1de597a6f8c568Derek SollenbergerDEF_BENCH( return new ScaleTransDoubleMatrixBench(p); )
447