| Index: tools/gpu/gl/GLTestContext.h
|
| diff --git a/tools/gpu/gl/GLTestContext.h b/tools/gpu/gl/GLTestContext.h
|
| index efe9d8f100f7f36f9792ad26f1a83fd9fece5763..0d52e8d16d8e14f29161bfd6bf50b7efbe9a3d2e 100644
|
| --- a/tools/gpu/gl/GLTestContext.h
|
| +++ b/tools/gpu/gl/GLTestContext.h
|
| @@ -8,8 +8,10 @@
|
| #ifndef GLTestContext_DEFINED
|
| #define GLTestContext_DEFINED
|
|
|
| +#include "SkTypes.h"
|
| #include "TestContext.h"
|
| #include "gl/GrGLInterface.h"
|
| +#include <string>
|
|
|
| namespace sk_gpu_test {
|
| /**
|
| @@ -59,27 +61,36 @@ public:
|
| */
|
| virtual GLTestContext *createNew() const { return nullptr; }
|
|
|
| + template<typename Ret, typename... Args>
|
| + void getGLProcAddress(Ret(**out)(Args...),
|
| + const std::string& procname,
|
| + const std::string& ext = "") const {
|
| + using Proc = Ret(*)(Args...);
|
| + if (procname[0] != 'g' || procname[1] != 'l') {
|
| + SkFAIL("getGLProcAddress: proc name must have 'gl' prefix");
|
| + *out = nullptr;
|
| + return;
|
| + }
|
| + *out = reinterpret_cast<Proc>(this->onPlatformGetProcAddress((procname + ext).c_str()));
|
| + }
|
| +
|
| 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;
|
| };
|
|
|
|
|