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

Unified Diff: tools/gpu/gl/GLTestContext.h

Issue 2383383002: Move GPU fences into sk_gpu_test (Closed)
Patch Set: Move GPU fences into sk_gpu_test 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 side-by-side diff with in-line comments
Download patch
Index: tools/gpu/gl/GLTestContext.h
diff --git a/tools/gpu/gl/GLTestContext.h b/tools/gpu/gl/GLTestContext.h
index efe9d8f100f7f36f9792ad26f1a83fd9fece5763..5f36cffa731934db822837d3727630745a25d951 100644
--- a/tools/gpu/gl/GLTestContext.h
+++ b/tools/gpu/gl/GLTestContext.h
@@ -59,27 +59,38 @@ public:
*/
virtual GLTestContext *createNew() const { return nullptr; }
+ template<typename Ret, typename... Args>
+ void getGLProcAddress(Ret(**out)(Args...), const char* name, const char* ext = nullptr) const {
+ using Proc = Ret(*)(Args...);
+ if (!SkStrStartsWith(name, "gl")) {
+ SkFAIL("getGLProcAddress: proc name must have 'gl' prefix");
+ *out = nullptr;
+ } else if (ext) {
+ SkString fullname(name);
+ fullname.append(ext);
+ *out = reinterpret_cast<Proc>(this->onPlatformGetProcAddress(fullname.c_str()));
+ } else {
+ *out = reinterpret_cast<Proc>(this->onPlatformGetProcAddress(name));
+ }
+ }
+
protected:
GLTestContext();
/*
* Methods that sublcasses must call from their constructors and destructors.
*/
- void init(const GrGLInterface *, SkGpuFenceSync * = NULL);
+ void init(const GrGLInterface *, FenceSync* = nullptr);
void teardown() override;
virtual GrGLFuncPtr onPlatformGetProcAddress(const char *) const = 0;
private:
- class GLFenceSync; // SkGpuFenceSync implementation that uses the OpenGL functionality.
-
/** Subclass provides the gl interface object if construction was
* successful. */
SkAutoTUnref<const GrGLInterface> fGL;
- friend class GLFenceSync; // For onPlatformGetProcAddress.
-
typedef TestContext INHERITED;
};

Powered by Google App Engine
This is Rietveld 408576698