Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: bench/Sk4fBench.cpp

Issue 1650653002: SkNx Load/store: take any pointer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: simplify call sites Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkColor.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkColor.h" 9 #include "SkColor.h"
10 #include "SkNx.h" 10 #include "SkNx.h"
(...skipping 15 matching lines...) Expand all
26 const char* onGetName() override { return "Sk4f_roundtrip"; } 26 const char* onGetName() override { return "Sk4f_roundtrip"; }
27 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; } 27 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; }
28 28
29 void onDraw(int loops, SkCanvas* canvas) override { 29 void onDraw(int loops, SkCanvas* canvas) override {
30 // Unlike blackhole, junk can and probably will be a register. 30 // Unlike blackhole, junk can and probably will be a register.
31 uint32_t junk = 0; 31 uint32_t junk = 0;
32 uint32_t seed = 0; 32 uint32_t seed = 0;
33 for (int i = 0; i < loops; i++) { 33 for (int i = 0; i < loops; i++) {
34 uint32_t color = lcg_rand(&seed), 34 uint32_t color = lcg_rand(&seed),
35 back; 35 back;
36 auto f = SkNx_cast<float>(Sk4b::Load((const uint8_t*)&color)); 36 auto f = SkNx_cast<float>(Sk4b::Load(&color));
37 SkNx_cast<uint8_t>(f).store((uint8_t*)&back); 37 SkNx_cast<uint8_t>(f).store(&back);
38 junk ^= back; 38 junk ^= back;
39 } 39 }
40 blackhole ^= junk; 40 blackhole ^= junk;
41 } 41 }
42 }; 42 };
43 DEF_BENCH(return new Sk4fBytesRoundtripBench;) 43 DEF_BENCH(return new Sk4fBytesRoundtripBench;)
44 44
45 struct Sk4fGradientBench : public Benchmark { 45 struct Sk4fGradientBench : public Benchmark {
46 const char* onGetName() override { return "Sk4f_gradient"; } 46 const char* onGetName() override { return "Sk4f_gradient"; }
47 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; } 47 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; }
(...skipping 17 matching lines...) Expand all
65 Sk4f_ToBytes((uint8_t*)(fDevice+i), a, b, c, d); 65 Sk4f_ToBytes((uint8_t*)(fDevice+i), a, b, c, d);
66 a = a + dcdx4; 66 a = a + dcdx4;
67 b = b + dcdx4; 67 b = b + dcdx4;
68 c = c + dcdx4; 68 c = c + dcdx4;
69 d = d + dcdx4; 69 d = d + dcdx4;
70 } 70 }
71 } 71 }
72 } 72 }
73 }; 73 };
74 DEF_BENCH(return new Sk4fGradientBench;) 74 DEF_BENCH(return new Sk4fGradientBench;)
OLDNEW
« no previous file with comments | « no previous file | src/core/SkColor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698