| Index: tools/gpu/gl/GLTestContext.h
|
| diff --git a/tools/gpu/gl/GLTestContext.h b/tools/gpu/gl/GLTestContext.h
|
| index efe9d8f100f7f36f9792ad26f1a83fd9fece5763..0cd9762f8bd5b148a8ffb3d14e2871f657624168 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;
|
| };
|
|
|
|
|