aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-05-11 10:38:05 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-11 10:38:06 -0700
commit0fd3c818612376afd54bad66d519feb7505b5d52 (patch)
tree1aeef7a524ccfd2abad35945cdbc2cffdfc925e8 /tools
parent6a51491b2491a646f2e378ccbae301136b6ec215 (diff)
Make unit tests use generic testcontext rather than glcontext
Diffstat (limited to 'tools')
-rw-r--r--tools/gpu/GrContextFactory.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/gpu/GrContextFactory.h b/tools/gpu/GrContextFactory.h
index dc896a7bc8..ed8e645199 100644
--- a/tools/gpu/GrContextFactory.h
+++ b/tools/gpu/GrContextFactory.h
@@ -28,6 +28,8 @@ public:
GrContext* grContext() const { return fGrContext; }
+ TestContext* testContext() const { return fTestContext; }
+
GLTestContext* glContext() const {
SkASSERT(kOpenGL_GrBackend == fBackend);
return static_cast<GLTestContext*>(fTestContext);
@@ -93,6 +95,18 @@ public:
kRequireSRGBSupport_ContextOptions = 0x2,
};
+ static ContextType NativeContextTypeForBackend(GrBackend backend) {
+ switch (backend) {
+ case kOpenGL_GrBackend:
+ return kNativeGL_ContextType;
+ case kVulkan_GrBackend:
+ return kVulkan_ContextType;
+ default:
+ SkFAIL("Unknown backend");
+ return kNullGL_ContextType;
+ }
+ }
+
static bool IsRenderingContext(ContextType type) {
switch (type) {
case kNullGL_ContextType: