From 292ce737285a9ee3f1d5395e7ff7f56082e3f214 Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Fri, 3 May 2013 16:28:33 +0000 Subject: [PATCH] Add benches for all xfermodes. R=reed@google.com Review URL: https://codereview.chromium.org/14818005 git-svn-id: http://skia.googlecode.com/svn/trunk@8990 2bbb7eff-a529-9590-31e7-b0007b416f81 --- bench/XfermodeBench.cpp | 72 ++++++++++++++++++++++++++++++++++------- 1 file changed, 61 insertions(+), 11 deletions(-) diff --git a/bench/XfermodeBench.cpp b/bench/XfermodeBench.cpp index 0d7fe6f200..a1e5a3d776 100644 --- a/bench/XfermodeBench.cpp +++ b/bench/XfermodeBench.cpp @@ -46,9 +46,9 @@ protected: private: enum { - kNumRects = SkBENCHLOOP(1000), - kMinSize = 10, - kMaxSize = 400, + kNumRects = SkBENCHLOOP(75), + kMinSize = 50, + kMaxSize = 100, }; SkAutoTUnref fXfermode; SkString fName; @@ -58,13 +58,63 @@ private: ////////////////////////////////////////////////////////////////////////////// +static SkBenchmark* Fact00(void* p) { return new XfermodeBench(p, SkXfermode::kClear_Mode); } +static SkBenchmark* Fact01(void* p) { return new XfermodeBench(p, SkXfermode::kSrc_Mode); } +static SkBenchmark* Fact02(void* p) { return new XfermodeBench(p, SkXfermode::kDst_Mode); } +static SkBenchmark* Fact03(void* p) { return new XfermodeBench(p, SkXfermode::kSrcOver_Mode); } +static SkBenchmark* Fact04(void* p) { return new XfermodeBench(p, SkXfermode::kDstOver_Mode); } +static SkBenchmark* Fact05(void* p) { return new XfermodeBench(p, SkXfermode::kSrcIn_Mode); } +static SkBenchmark* Fact06(void* p) { return new XfermodeBench(p, SkXfermode::kDstIn_Mode); } +static SkBenchmark* Fact07(void* p) { return new XfermodeBench(p, SkXfermode::kSrcOut_Mode); } +static SkBenchmark* Fact08(void* p) { return new XfermodeBench(p, SkXfermode::kDstOut_Mode); } +static SkBenchmark* Fact09(void* p) { return new XfermodeBench(p, SkXfermode::kSrcATop_Mode); } +static SkBenchmark* Fact10(void* p) { return new XfermodeBench(p, SkXfermode::kDstATop_Mode); } +static SkBenchmark* Fact11(void* p) { return new XfermodeBench(p, SkXfermode::kXor_Mode); } +static SkBenchmark* Fact12(void* p) { return new XfermodeBench(p, SkXfermode::kPlus_Mode); } +static SkBenchmark* Fact13(void* p) { return new XfermodeBench(p, SkXfermode::kModulate_Mode); } +static SkBenchmark* Fact14(void* p) { return new XfermodeBench(p, SkXfermode::kScreen_Mode); } +static SkBenchmark* Fact15(void* p) { return new XfermodeBench(p, SkXfermode::kOverlay_Mode); } +static SkBenchmark* Fact16(void* p) { return new XfermodeBench(p, SkXfermode::kDarken_Mode); } +static SkBenchmark* Fact17(void* p) { return new XfermodeBench(p, SkXfermode::kLighten_Mode); } +static SkBenchmark* Fact18(void* p) { return new XfermodeBench(p, SkXfermode::kColorDodge_Mode); } +static SkBenchmark* Fact19(void* p) { return new XfermodeBench(p, SkXfermode::kColorBurn_Mode); } +static SkBenchmark* Fact20(void* p) { return new XfermodeBench(p, SkXfermode::kHardLight_Mode); } +static SkBenchmark* Fact21(void* p) { return new XfermodeBench(p, SkXfermode::kSoftLight_Mode); } +static SkBenchmark* Fact22(void* p) { return new XfermodeBench(p, SkXfermode::kDifference_Mode); } +static SkBenchmark* Fact23(void* p) { return new XfermodeBench(p, SkXfermode::kExclusion_Mode); } +static SkBenchmark* Fact24(void* p) { return new XfermodeBench(p, SkXfermode::kMultiply_Mode); } +static SkBenchmark* Fact25(void* p) { return new XfermodeBench(p, SkXfermode::kHue_Mode); } +static SkBenchmark* Fact26(void* p) { return new XfermodeBench(p, SkXfermode::kSaturation_Mode); } +static SkBenchmark* Fact27(void* p) { return new XfermodeBench(p, SkXfermode::kColor_Mode); } +static SkBenchmark* Fact28(void* p) { return new XfermodeBench(p, SkXfermode::kLuminosity_Mode); } -// These modes were chosen because they are expected to be successively harder for the GPU. -// kSrc can disable blending, kSrcOver cannot, kDarken requires reading the dst pixel in the shader. -static SkBenchmark* Fact0(void* p) { return new XfermodeBench(p, SkXfermode::kSrc_Mode); } -static SkBenchmark* Fact1(void* p) { return new XfermodeBench(p, SkXfermode::kSrcOver_Mode); } -static SkBenchmark* Fact2(void* p) { return new XfermodeBench(p, SkXfermode::kDarken_Mode); } +static BenchRegistry gReg00(Fact00); +static BenchRegistry gReg01(Fact01); +static BenchRegistry gReg02(Fact02); +static BenchRegistry gReg03(Fact03); +static BenchRegistry gReg04(Fact04); +static BenchRegistry gReg05(Fact05); +static BenchRegistry gReg06(Fact06); +static BenchRegistry gReg07(Fact07); +static BenchRegistry gReg08(Fact08); +static BenchRegistry gReg09(Fact09); +static BenchRegistry gReg10(Fact10); +static BenchRegistry gReg11(Fact11); +static BenchRegistry gReg12(Fact12); +static BenchRegistry gReg13(Fact13); +static BenchRegistry gReg14(Fact14); +static BenchRegistry gReg15(Fact15); +static BenchRegistry gReg16(Fact16); +static BenchRegistry gReg17(Fact17); +static BenchRegistry gReg18(Fact18); +static BenchRegistry gReg19(Fact19); +static BenchRegistry gReg20(Fact20); +static BenchRegistry gReg21(Fact21); +static BenchRegistry gReg22(Fact22); +static BenchRegistry gReg23(Fact23); +static BenchRegistry gReg24(Fact24); +static BenchRegistry gReg25(Fact25); +static BenchRegistry gReg26(Fact26); +static BenchRegistry gReg27(Fact27); +static BenchRegistry gReg28(Fact28); -static BenchRegistry gReg0(Fact0); -static BenchRegistry gReg1(Fact1); -static BenchRegistry gReg2(Fact2);