From 74fc727dc88ee24d89f88cb1709f963e9073aeb3 Mon Sep 17 00:00:00 2001 From: kkinnunen Date: Sun, 22 Jun 2014 22:56:53 -0700 Subject: Support using OpenGL ES context on desktop Support using OpenGL ES context on desktop for unix and Android platforms. This is mainly useful in development. Add --gpuAPI flag to gm, dm, bench, bench_pictures and render_pictures. The possible parameters for the flag are "gl" and "gles". R=bsalomon@google.com, mtklein@google.com, robertphillips@google.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/319043005 --- include/gpu/GrContextFactory.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'include/gpu/GrContextFactory.h') diff --git a/include/gpu/GrContextFactory.h b/include/gpu/GrContextFactory.h index f09bad932b..1f1f89df14 100644 --- a/include/gpu/GrContextFactory.h +++ b/include/gpu/GrContextFactory.h @@ -88,8 +88,7 @@ public: } } - GrContextFactory() { - } + GrContextFactory() { } ~GrContextFactory() { this->destroyContexts(); } @@ -105,9 +104,12 @@ public: /** * Get a GrContext initialized with a type of GL context. It also makes the GL context current. */ - GrContext* get(GLContextType type) { - + GrContext* get(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLStandard) { for (int i = 0; i < fContexts.count(); ++i) { + if (forcedGpuAPI != kNone_GrGLStandard && + forcedGpuAPI != fContexts[i].fGLContext->gl()->fStandard) + continue; + if (fContexts[i].fType == type) { fContexts[i].fGLContext->makeCurrent(); return fContexts[i].fGrContext; @@ -141,7 +143,7 @@ public: if (!glCtx.get()) { return NULL; } - if (!glCtx.get()->init(kBogusSize, kBogusSize)) { + if (!glCtx.get()->init(forcedGpuAPI, kBogusSize, kBogusSize)) { return NULL; } -- cgit v1.2.3