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

Side by Side Diff: tools/gpu/TestContext.cpp

Issue 2388433003: skpbench: add option for gpu timing (Closed)
Patch Set: SkAutoTDelete Created 4 years, 2 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 | « tools/gpu/TestContext.h ('k') | tools/gpu/gl/GLTestContext.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 /* 2 /*
3 * Copyright 2016 Google Inc. 3 * Copyright 2016 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "TestContext.h" 9 #include "TestContext.h"
10 10
11 #include "GpuTimer.h"
12
11 namespace sk_gpu_test { 13 namespace sk_gpu_test {
12 TestContext::TestContext() : fFenceSync(nullptr), fCurrentFenceIdx(0) { 14 TestContext::TestContext()
15 : fFenceSync(nullptr)
16 , fGpuTimer(nullptr)
17 , fCurrentFenceIdx(0) {
13 memset(fFrameFences, 0, sizeof(fFrameFences)); 18 memset(fFrameFences, 0, sizeof(fFrameFences));
14 } 19 }
15 20
16 TestContext::~TestContext() { 21 TestContext::~TestContext() {
17 // Subclass should call teardown. 22 // Subclass should call teardown.
18 #ifdef SK_DEBUG 23 #ifdef SK_DEBUG
19 for (size_t i = 0; i < SK_ARRAY_COUNT(fFrameFences); i++) { 24 for (size_t i = 0; i < SK_ARRAY_COUNT(fFrameFences); i++) {
20 SkASSERT(0 == fFrameFences[i]); 25 SkASSERT(0 == fFrameFences[i]);
21 } 26 }
22 #endif 27 #endif
23 SkASSERT(!fFenceSync); 28 SkASSERT(!fFenceSync);
29 SkASSERT(!fGpuTimer);
24 } 30 }
25 31
26 void TestContext::makeCurrent() const { this->onPlatformMakeCurrent(); } 32 void TestContext::makeCurrent() const { this->onPlatformMakeCurrent(); }
27 33
28 void TestContext::swapBuffers() { this->onPlatformSwapBuffers(); } 34 void TestContext::swapBuffers() { this->onPlatformSwapBuffers(); }
29 35
30 void TestContext::waitOnSyncOrSwap() { 36 void TestContext::waitOnSyncOrSwap() {
31 if (!fFenceSync) { 37 if (!fFenceSync) {
32 // Fallback on the platform SwapBuffers method for synchronization. This may have no effect. 38 // Fallback on the platform SwapBuffers method for synchronization. This may have no effect.
33 this->swapBuffers(); 39 this->swapBuffers();
(...skipping 19 matching lines...) Expand all
53 } 59 }
54 60
55 void TestContext::teardown() { 61 void TestContext::teardown() {
56 if (fFenceSync) { 62 if (fFenceSync) {
57 for (size_t i = 0; i < SK_ARRAY_COUNT(fFrameFences); i++) { 63 for (size_t i = 0; i < SK_ARRAY_COUNT(fFrameFences); i++) {
58 if (fFrameFences[i]) { 64 if (fFrameFences[i]) {
59 fFenceSync->deleteFence(fFrameFences[i]); 65 fFenceSync->deleteFence(fFrameFences[i]);
60 fFrameFences[i] = 0; 66 fFrameFences[i] = 0;
61 } 67 }
62 } 68 }
63 delete fFenceSync; 69 fFenceSync.reset();
64 fFenceSync = nullptr;
65 } 70 }
71 fGpuTimer.reset();
66 } 72 }
67 73
68 } 74 }
OLDNEW
« no previous file with comments | « tools/gpu/TestContext.h ('k') | tools/gpu/gl/GLTestContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698