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

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

Issue 2395573002: Revert of Move GPU fences into sk_gpu_test (Closed)
Patch Set: 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/FenceSync.h ('k') | tools/gpu/gl/GLTestContext.h » ('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 #ifndef TestContext_DEFINED 9 #ifndef TestContext_DEFINED
10 #define TestContext_DEFINED 10 #define TestContext_DEFINED
11 11
12 #include "FenceSync.h"
13 #include "GrTypes.h" 12 #include "GrTypes.h"
13 #include "../private/SkGpuFenceSync.h"
14 #include "../private/SkTemplates.h" 14 #include "../private/SkTemplates.h"
15 15
16 namespace sk_gpu_test { 16 namespace sk_gpu_test {
17 /** 17 /**
18 * An offscreen 3D context. This class is intended for Skia's internal testing n eeds and not 18 * An offscreen 3D context. This class is intended for Skia's internal testing n eeds and not
19 * for general use. 19 * for general use.
20 */ 20 */
21 class TestContext : public SkNoncopyable { 21 class TestContext : public SkNoncopyable {
22 public: 22 public:
23 virtual ~TestContext(); 23 virtual ~TestContext();
24 24
25 virtual bool isValid() const = 0; 25 virtual bool isValid() const = 0;
26 26
27 bool fenceSyncSupport() const { return fFenceSync != nullptr; } 27 bool fenceSyncSupport() const { return fFenceSync != nullptr; }
28 FenceSync* fenceSync() { SkASSERT(fFenceSync); return fFenceSync; }
29 28
30 bool getMaxGpuFrameLag(int *maxFrameLag) const { 29 bool getMaxGpuFrameLag(int *maxFrameLag) const {
31 if (!fFenceSync) { 30 if (!fFenceSync) {
32 return false; 31 return false;
33 } 32 }
34 *maxFrameLag = kMaxFrameLag; 33 *maxFrameLag = kMaxFrameLag;
35 return true; 34 return true;
36 } 35 }
37 36
38 void makeCurrent() const; 37 void makeCurrent() const;
(...skipping 28 matching lines...) Expand all
67 * context to test that further API calls are not made by Skia GPU code. 66 * context to test that further API calls are not made by Skia GPU code.
68 */ 67 */
69 virtual void testAbandon(); 68 virtual void testAbandon();
70 69
71 /** Ensures all work is submitted to the GPU for execution. */ 70 /** Ensures all work is submitted to the GPU for execution. */
72 virtual void submit() = 0; 71 virtual void submit() = 0;
73 72
74 /** Wait until all GPU work is finished. */ 73 /** Wait until all GPU work is finished. */
75 virtual void finish() = 0; 74 virtual void finish() = 0;
76 75
76 /**
77 * returns the fencesync object owned by this GLTestContext
78 */
79 SkGpuFenceSync *fenceSync() { return fFenceSync; }
80
77 protected: 81 protected:
78 FenceSync* fFenceSync; 82 SkGpuFenceSync* fFenceSync;
79 83
80 TestContext(); 84 TestContext();
81 85
82 /** This should destroy the 3D context. */ 86 /** This should destroy the 3D context. */
83 virtual void teardown(); 87 virtual void teardown();
84 88
85 virtual void onPlatformMakeCurrent() const = 0; 89 virtual void onPlatformMakeCurrent() const = 0;
86 virtual void onPlatformSwapBuffers() const = 0; 90 virtual void onPlatformSwapBuffers() const = 0;
87 91
88 private: 92 private:
89 enum { 93 enum {
90 kMaxFrameLag = 3 94 kMaxFrameLag = 3
91 }; 95 };
92 96
93 PlatformFence fFrameFences[kMaxFrameLag - 1]; 97 SkPlatformGpuFence fFrameFences[kMaxFrameLag - 1];
94 int fCurrentFenceIdx; 98 int fCurrentFenceIdx;
95 99
96 typedef SkNoncopyable INHERITED; 100 typedef SkNoncopyable INHERITED;
97 }; 101 };
98 } // namespace sk_gpu_test 102 } // namespace sk_gpu_test
99 #endif 103 #endif
OLDNEW
« no previous file with comments | « tools/gpu/FenceSync.h ('k') | tools/gpu/gl/GLTestContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698