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

Side by Side Diff: tools/gpu/gl/GLTestContext.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/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 2013 Google Inc. 3 * Copyright 2013 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 #ifndef GLTestContext_DEFINED 8 #ifndef GLTestContext_DEFINED
9 #define GLTestContext_DEFINED 9 #define GLTestContext_DEFINED
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 /** Wait until all GPU work is finished. */ 53 /** Wait until all GPU work is finished. */
54 void finish() override; 54 void finish() override;
55 55
56 /** 56 /**
57 * Creates a new GL context of the same type and makes the returned context current 57 * Creates a new GL context of the same type and makes the returned context current
58 * (if not null). 58 * (if not null).
59 */ 59 */
60 virtual GLTestContext *createNew() const { return nullptr; } 60 virtual GLTestContext *createNew() const { return nullptr; }
61 61
62 template<typename Ret, typename... Args>
63 void getGLProcAddress(Ret(GR_GL_FUNCTION_TYPE** out)(Args...),
64 const char* name, const char* ext = nullptr) const {
65 using Proc = Ret(GR_GL_FUNCTION_TYPE*)(Args...);
66 if (!SkStrStartsWith(name, "gl")) {
67 SkFAIL("getGLProcAddress: proc name must have 'gl' prefix");
68 *out = nullptr;
69 } else if (ext) {
70 SkString fullname(name);
71 fullname.append(ext);
72 *out = reinterpret_cast<Proc>(this->onPlatformGetProcAddress(fullnam e.c_str()));
73 } else {
74 *out = reinterpret_cast<Proc>(this->onPlatformGetProcAddress(name));
75 }
76 }
77
78 protected: 62 protected:
79 GLTestContext(); 63 GLTestContext();
80 64
81 /* 65 /*
82 * Methods that sublcasses must call from their constructors and destructors . 66 * Methods that sublcasses must call from their constructors and destructors .
83 */ 67 */
84 void init(const GrGLInterface *, FenceSync* = nullptr); 68 void init(const GrGLInterface *, SkGpuFenceSync * = NULL);
85 69
86 void teardown() override; 70 void teardown() override;
87 71
88 virtual GrGLFuncPtr onPlatformGetProcAddress(const char *) const = 0; 72 virtual GrGLFuncPtr onPlatformGetProcAddress(const char *) const = 0;
89 73
90 private: 74 private:
75 class GLFenceSync; // SkGpuFenceSync implementation that uses the OpenGL fu nctionality.
76
91 /** Subclass provides the gl interface object if construction was 77 /** Subclass provides the gl interface object if construction was
92 * successful. */ 78 * successful. */
93 SkAutoTUnref<const GrGLInterface> fGL; 79 SkAutoTUnref<const GrGLInterface> fGL;
94 80
81 friend class GLFenceSync; // For onPlatformGetProcAddress.
82
95 typedef TestContext INHERITED; 83 typedef TestContext INHERITED;
96 }; 84 };
97 85
98 /** 86 /**
99 * Creates platform-dependent GL context object. The shareContext parameter is in an optional 87 * Creates platform-dependent GL context object. The shareContext parameter is in an optional
100 * context with which to share display lists. This should be a pointer to an GLT estContext created 88 * context with which to share display lists. This should be a pointer to an GLT estContext created
101 * with SkCreatePlatformGLTestContext. NULL indicates that no sharing is to tak e place. Returns a 89 * with SkCreatePlatformGLTestContext. NULL indicates that no sharing is to tak e place. Returns a
102 * valid gl context object or NULL if such can not be created. 90 * valid gl context object or NULL if such can not be created.
103 */ 91 */
104 GLTestContext* CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI, 92 GLTestContext* CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI,
105 GLTestContext *shareContext = nullptr ); 93 GLTestContext *shareContext = nullptr );
106 94
107 } // namespace sk_gpu_test 95 } // namespace sk_gpu_test
108 #endif 96 #endif
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