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

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
« no previous file with comments | « tools/gpu/TestContext.h ('k') | tools/gpu/gl/GLTestContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
csmartdalton 2016/10/03 22:13:35 Should we still be using SkString in internal tool
bsalomon 2016/10/04 13:40:45 I think so. Not that SkString is necessarily any b
csmartdalton 2016/10/04 15:51:00 Done.
+ 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;
};
« 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