| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "GrCaps.h" | 8 #include "GrCaps.h" |
| 9 #include "GrContextFactory.h" | 9 #include "GrContextFactory.h" |
| 10 #include "Benchmark.h" | 10 #include "Benchmark.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 // To ensure waiting for the sync actually does something, we check to make
sure the we exceed | 295 // To ensure waiting for the sync actually does something, we check to make
sure the we exceed |
| 296 // some small value | 296 // some small value |
| 297 const double kMinElapsed = 1e-6; | 297 const double kMinElapsed = 1e-6; |
| 298 bool sanity(double start) const { | 298 bool sanity(double start) const { |
| 299 double elapsed = now_ms() - start; | 299 double elapsed = now_ms() - start; |
| 300 return elapsed > kMinElapsed; | 300 return elapsed > kMinElapsed; |
| 301 } | 301 } |
| 302 | 302 |
| 303 void waitFence(SkPlatformGpuFence sync) { | 303 void waitFence(SkPlatformGpuFence sync) { |
| 304 SkDEBUGCODE(double start = now_ms()); | 304 SkDEBUGCODE(double start = now_ms()); |
| 305 fFenceSync->waitFence(sync, false); | 305 fFenceSync->waitFence(sync); |
| 306 SkASSERT(sanity(start)); | 306 SkASSERT(sanity(start)); |
| 307 } | 307 } |
| 308 | 308 |
| 309 void timingLoop() { | 309 void timingLoop() { |
| 310 // Create a context which shares display lists with the main thread | 310 // Create a context which shares display lists with the main thread |
| 311 SkAutoTDelete<GLTestContext> glContext(CreatePlatformGLTestContext(kNone
_GrGLStandard, | 311 SkAutoTDelete<GLTestContext> glContext(CreatePlatformGLTestContext(kNone
_GrGLStandard, |
| 312 fMain
Context)); | 312 fMain
Context)); |
| 313 glContext->makeCurrent(); | 313 glContext->makeCurrent(); |
| 314 | 314 |
| 315 // Basic timing methodology is: | 315 // Basic timing methodology is: |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 } | 648 } |
| 649 return 0; | 649 return 0; |
| 650 } | 650 } |
| 651 | 651 |
| 652 #if !defined SK_BUILD_FOR_IOS | 652 #if !defined SK_BUILD_FOR_IOS |
| 653 int main(int argc, char** argv) { | 653 int main(int argc, char** argv) { |
| 654 SkCommandLineFlags::Parse(argc, argv); | 654 SkCommandLineFlags::Parse(argc, argv); |
| 655 return kilobench_main(); | 655 return kilobench_main(); |
| 656 } | 656 } |
| 657 #endif | 657 #endif |
| OLD | NEW |