aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/gpu/gl/GLTestContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gpu/gl/GLTestContext.h')
-rw-r--r--tools/gpu/gl/GLTestContext.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/tools/gpu/gl/GLTestContext.h b/tools/gpu/gl/GLTestContext.h
index efe9d8f100..0cd9762f8b 100644
--- a/tools/gpu/gl/GLTestContext.h
+++ b/tools/gpu/gl/GLTestContext.h
@@ -59,27 +59,39 @@ public:
*/
virtual GLTestContext *createNew() const { return nullptr; }
+ template<typename Ret, typename... Args>
+ void getGLProcAddress(Ret(GR_GL_FUNCTION_TYPE** out)(Args...),
+ const char* name, const char* ext = nullptr) const {
+ using Proc = Ret(GR_GL_FUNCTION_TYPE*)(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;
};