MatrixBench.cpp revision 80bacfeb4bda06541e8695bd502229727bccfea
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
3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void onDraw(SkCanvas* canvas) {
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 Queru#ifdef SK_SCALAR_IS_FLOAT
26880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass ScaleTransMixedMatrixBench : public MatrixBench {
26980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru public:
27080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    ScaleTransMixedMatrixBench(void* p) : INHERITED(p, "scaletrans_mixed"), fCount (16) {
27180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fMatrix.setAll(fRandom.nextSScalar1(), fRandom.nextSScalar1(), fRandom.nextSScalar1(),
27280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                       fRandom.nextSScalar1(), fRandom.nextSScalar1(), fRandom.nextSScalar1(),
27380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                       fRandom.nextSScalar1(), fRandom.nextSScalar1(), fRandom.nextSScalar1());
27480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        int i;
27580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        for (i = 0; i < SkBENCHLOOP(fCount); i++) {
27680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fSrc[i].fX = fRandom.nextSScalar1();
27780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fSrc[i].fY = fRandom.nextSScalar1();
27880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fDst[i].fX = fRandom.nextSScalar1();
27980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fDst[i].fY = fRandom.nextSScalar1();
28080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
28180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
28280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru protected:
28380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void performTest() {
28480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkPoint* dst = fDst;
28580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        const SkPoint* src = fSrc;
28680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        int count = SkBENCHLOOP(fCount);
28780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float mx = fMatrix[SkMatrix::kMScaleX];
28880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float my = fMatrix[SkMatrix::kMScaleY];
28980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float tx = fMatrix[SkMatrix::kMTransX];
29080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float ty = fMatrix[SkMatrix::kMTransY];
29180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        do {
29280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            dst->fY = SkScalarMulAdd(src->fY, my, ty);
29380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            dst->fX = SkScalarMulAdd(src->fX, mx, tx);
29480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            src += 1;
29580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            dst += 1;
29680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        } while (--count);
29780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
29880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru private:
29980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkMatrix fMatrix;
30080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkPoint fSrc [16];
30180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkPoint fDst [16];
30280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    int fCount;
30380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkRandom fRandom;
30480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef MatrixBench INHERITED;
30580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
30680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
30780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass ScaleTransDoubleMatrixBench : public MatrixBench {
30880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru public:
30980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    ScaleTransDoubleMatrixBench(void* p) : INHERITED(p, "scaletrans_double"), fCount (16) {
31080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        init9(fMatrix);
31180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        int i;
31280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        for (i = 0; i < SkBENCHLOOP(fCount); i++) {
31380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fSrc[i].fX = fRandom.nextSScalar1();
31480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fSrc[i].fY = fRandom.nextSScalar1();
31580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fDst[i].fX = fRandom.nextSScalar1();
31680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fDst[i].fY = fRandom.nextSScalar1();
31780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
31880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
31980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru protected:
32080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void performTest() {
32180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkPoint* dst = fDst;
32280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        const SkPoint* src = fSrc;
32380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        int count = SkBENCHLOOP(fCount);
32480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        // As doubles, on Z600 Linux systems this is 2.5x as expensive as mixed mode
32580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float mx = (float) fMatrix[SkMatrix::kMScaleX];
32680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float my = (float) fMatrix[SkMatrix::kMScaleY];
32780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float tx = (float) fMatrix[SkMatrix::kMTransX];
32880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        float ty = (float) fMatrix[SkMatrix::kMTransY];
32980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        do {
33080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            dst->fY = src->fY * my + ty;
33180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            dst->fX = src->fX * mx + tx;
33280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            src += 1;
33380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            dst += 1;
33480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        } while (--count);
33580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
33680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru private:
33780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    double fMatrix [9];
33880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkPoint fSrc [16];
33980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkPoint fDst [16];
34080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    int fCount;
34180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkRandom fRandom;
34280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef MatrixBench INHERITED;
34380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
34480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
34580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
34680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass InvertMapRectMatrixBench : public MatrixBench {
34780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
34880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    InvertMapRectMatrixBench(void* param, const char* name, int flags)
34980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        : INHERITED(param, name)
35080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        , fFlags(flags) {
35180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fMatrix.reset();
35280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fIteration = 0;
35380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (flags & kScale_Flag) {
35480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.postScale(SkFloatToScalar(1.5f), SkFloatToScalar(2.5f));
35580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
35680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (flags & kTranslate_Flag) {
35780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.postTranslate(SkFloatToScalar(1.5f), SkFloatToScalar(2.5f));
35880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
35980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (flags & kRotate_Flag) {
36080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.postRotate(SkFloatToScalar(45.0f));
36180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
36280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (flags & kPerspective_Flag) {
36380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.setPerspX(SkFloatToScalar(1.5f));
36480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.setPerspY(SkFloatToScalar(2.5f));
36580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
36680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (0 == (flags & kUncachedTypeMask_Flag)) {
36780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.getType();
36880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
36980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
37080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    enum Flag {
37180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kScale_Flag             = 0x01,
37280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kTranslate_Flag         = 0x02,
37380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kRotate_Flag            = 0x04,
37480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kPerspective_Flag       = 0x08,
37580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kUncachedTypeMask_Flag  = 0x10,
37680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    };
37780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
37880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    virtual void performTest() {
37980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (fFlags & kUncachedTypeMask_Flag) {
38080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            // This will invalidate the typemask without
38180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            // changing the matrix.
38280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            fMatrix.setPerspX(fMatrix.getPerspX());
38380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
38480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkMatrix inv;
38580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        bool invertible = fMatrix.invert(&inv);
38680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkASSERT(invertible);
38780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkRect transformedRect;
38880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        // an arbitrary, small, non-zero rect to transform
38980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        SkRect srcRect = SkRect::MakeWH(SkIntToScalar(10), SkIntToScalar(10));
39080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        if (invertible) {
39180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            inv.mapRect(&transformedRect, srcRect);
39280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        }
39380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
39480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
39580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkMatrix fMatrix;
39680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    int fFlags;
39780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    unsigned fIteration;
39880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef MatrixBench INHERITED;
39980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
40080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
40180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
40280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
40380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
40480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* M0(void* p) { return new EqualsMatrixBench(p); }
40580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* M1(void* p) { return new ScaleMatrixBench(p); }
40680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* M2(void* p) { return new FloatConcatMatrixBench(p); }
40780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* M3(void* p) { return new FloatDoubleConcatMatrixBench(p); }
40880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* M4(void* p) { return new DoubleConcatMatrixBench(p); }
40980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* M5(void* p) { return new GetTypeMatrixBench(p); }
41080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* M6(void* p) {
41180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    return new InvertMapRectMatrixBench(p,
41280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        "invert_maprect_identity", 0);
41380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}
41480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* M7(void* p) {
41580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    return new InvertMapRectMatrixBench(p,
41680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        "invert_maprect_rectstaysrect",
41780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        InvertMapRectMatrixBench::kScale_Flag |
41880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        InvertMapRectMatrixBench::kTranslate_Flag);
41980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}
42080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* M8(void* p) {
42180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    return new InvertMapRectMatrixBench(p,
42280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        "invert_maprect_nonpersp",
42380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        InvertMapRectMatrixBench::kScale_Flag |
42480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        InvertMapRectMatrixBench::kRotate_Flag |
42580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        InvertMapRectMatrixBench::kTranslate_Flag);
42680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}
42780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* M9(void* p) {
42880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    return new InvertMapRectMatrixBench(p,
42980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        "invert_maprect_persp",
43080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        InvertMapRectMatrixBench::kPerspective_Flag);
43180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}
43280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* M10(void* p) {
43380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    return new InvertMapRectMatrixBench(p,
43480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        "invert_maprect_typemask_rectstaysrect",
43580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        InvertMapRectMatrixBench::kUncachedTypeMask_Flag |
43680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        InvertMapRectMatrixBench::kScale_Flag |
43780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        InvertMapRectMatrixBench::kTranslate_Flag);
43880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}
43980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* M11(void* p) {
44080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    return new InvertMapRectMatrixBench(p,
44180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        "invert_maprect_typemask_nonpersp",
44280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        InvertMapRectMatrixBench::kUncachedTypeMask_Flag |
44380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        InvertMapRectMatrixBench::kScale_Flag |
44480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        InvertMapRectMatrixBench::kRotate_Flag |
44580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        InvertMapRectMatrixBench::kTranslate_Flag);
44680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}
44780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
44880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gReg0(M0);
44980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gReg1(M1);
45080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gReg2(M2);
45180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gReg3(M3);
45280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gReg4(M4);
45380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gReg5(M5);
45480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gReg6(M6);
45580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gReg7(M7);
45680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gReg8(M8);
45780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gReg9(M9);
45880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gReg10(M10);
45980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gReg11(M11);
46080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
46180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifdef SK_SCALAR_IS_FLOAT
46280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* FlM0(void* p) { return new ScaleTransMixedMatrixBench(p); }
46380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBenchmark* FlM1(void* p) { return new ScaleTransDoubleMatrixBench(p); }
46480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gFlReg5(FlM0);
46580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic BenchRegistry gFlReg6(FlM1);
46680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
467