diff options
author | 2014-06-30 06:36:31 -0700 | |
---|---|---|
committer | 2014-06-30 06:36:31 -0700 | |
commit | 80549fcdd50269d7e069d6db02b395fca128056c (patch) | |
tree | f190d563157d1e5e41f26e0bc1cf724b17a7f3c4 /include/gpu | |
parent | b8562be65510ea2703e1e34029da8c8f501c340c (diff) |
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
Diffstat (limited to 'include/gpu')
-rw-r--r-- | include/gpu/GrContextFactory.h | 12 | ||||
-rw-r--r-- | include/gpu/gl/SkANGLEGLContext.h | 3 | ||||
-rw-r--r-- | include/gpu/gl/SkDebugGLContext.h | 2 | ||||
-rw-r--r-- | include/gpu/gl/SkGLContextHelper.h | 4 | ||||
-rw-r--r-- | include/gpu/gl/SkMesaGLContext.h | 2 | ||||
-rw-r--r-- | include/gpu/gl/SkNativeGLContext.h | 2 | ||||
-rw-r--r-- | include/gpu/gl/SkNullGLContext.h | 2 |
7 files changed, 15 insertions, 12 deletions
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; } diff --git a/include/gpu/gl/SkANGLEGLContext.h b/include/gpu/gl/SkANGLEGLContext.h index 99ef4e9a99..c5f62ff3ce 100644 --- a/include/gpu/gl/SkANGLEGLContext.h +++ b/include/gpu/gl/SkANGLEGLContext.h @@ -36,7 +36,8 @@ public: }; protected: - virtual const GrGLInterface* createGLContext() SK_OVERRIDE; + virtual const GrGLInterface* createGLContext( + GrGLStandard forcedGpuAPI) SK_OVERRIDE; virtual void destroyGLContext() SK_OVERRIDE; private: diff --git a/include/gpu/gl/SkDebugGLContext.h b/include/gpu/gl/SkDebugGLContext.h index 545ef40027..9318cb455f 100644 --- a/include/gpu/gl/SkDebugGLContext.h +++ b/include/gpu/gl/SkDebugGLContext.h @@ -19,7 +19,7 @@ public: virtual void swapBuffers() const SK_OVERRIDE {}; protected: - virtual const GrGLInterface* createGLContext() SK_OVERRIDE; + virtual const GrGLInterface* createGLContext(GrGLStandard forcedGpuAPI) SK_OVERRIDE; virtual void destroyGLContext() SK_OVERRIDE {}; }; diff --git a/include/gpu/gl/SkGLContextHelper.h b/include/gpu/gl/SkGLContextHelper.h index ea940c8bc0..9da8741840 100644 --- a/include/gpu/gl/SkGLContextHelper.h +++ b/include/gpu/gl/SkGLContextHelper.h @@ -25,7 +25,7 @@ public: /** * Initializes the context and makes it current. */ - bool init(const int width, const int height); + bool init(GrGLStandard forcedGpuAPI, const int width, const int height); int getFBOID() const { return fFBO; } @@ -57,7 +57,7 @@ protected: * format and size of backbuffers does not matter since an FBO will be * created. */ - virtual const GrGLInterface* createGLContext() = 0; + virtual const GrGLInterface* createGLContext(GrGLStandard forcedGpuAPI) = 0; /** * Subclass should destroy the underlying GL context. diff --git a/include/gpu/gl/SkMesaGLContext.h b/include/gpu/gl/SkMesaGLContext.h index 55235fa603..28349ddd88 100644 --- a/include/gpu/gl/SkMesaGLContext.h +++ b/include/gpu/gl/SkMesaGLContext.h @@ -38,7 +38,7 @@ public: }; protected: - virtual const GrGLInterface* createGLContext() SK_OVERRIDE; + virtual const GrGLInterface* createGLContext(GrGLStandard forcedGpuAPI) SK_OVERRIDE; virtual void destroyGLContext() SK_OVERRIDE; private: diff --git a/include/gpu/gl/SkNativeGLContext.h b/include/gpu/gl/SkNativeGLContext.h index 7254de1509..fac52b354f 100644 --- a/include/gpu/gl/SkNativeGLContext.h +++ b/include/gpu/gl/SkNativeGLContext.h @@ -58,7 +58,7 @@ public: }; protected: - virtual const GrGLInterface* createGLContext() SK_OVERRIDE; + virtual const GrGLInterface* createGLContext(GrGLStandard forcedGpuAPI) SK_OVERRIDE; virtual void destroyGLContext() SK_OVERRIDE; private: diff --git a/include/gpu/gl/SkNullGLContext.h b/include/gpu/gl/SkNullGLContext.h index 02d968eeff..6c2a1d7e59 100644 --- a/include/gpu/gl/SkNullGLContext.h +++ b/include/gpu/gl/SkNullGLContext.h @@ -20,7 +20,7 @@ public: virtual void swapBuffers() const SK_OVERRIDE {}; protected: - virtual const GrGLInterface* createGLContext() SK_OVERRIDE; + virtual const GrGLInterface* createGLContext(GrGLStandard forcedGpuAPI) SK_OVERRIDE; virtual void destroyGLContext() SK_OVERRIDE {}; }; |