GLContextEAGL.h (1716B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef GLCONTEXTEAGL_H_ 8 #define GLCONTEXTEAGL_H_ 9 10 #include "GLContext.h" 11 12 #include <CoreGraphics/CoreGraphics.h> 13 #ifdef __OBJC__ 14 # include <OpenGLES/EAGL.h> 15 #else 16 typedef void EAGLContext; 17 #endif 18 19 namespace mozilla { 20 namespace gl { 21 22 class GLContextEAGL : public GLContext { 23 friend class GLContextProviderEAGL; 24 25 EAGLContext* const mContext; 26 27 public: 28 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextEAGL, override) 29 GLContextEAGL(const GLContextDesc&, EAGLContext* context, 30 GLContext* sharedContext); 31 32 ~GLContextEAGL(); 33 34 virtual GLContextType GetContextType() const override { 35 return GLContextType::EAGL; 36 } 37 38 static GLContextEAGL* Cast(GLContext* gl) { 39 MOZ_ASSERT(gl->GetContextType() == GLContextType::EAGL); 40 return static_cast<GLContextEAGL*>(gl); 41 } 42 43 EAGLContext* GetEAGLContext() const { return mContext; } 44 45 virtual bool MakeCurrentImpl() const override; 46 47 virtual bool IsCurrentImpl() const override; 48 49 Maybe<SymbolLoader> GetSymbolLoader() const override; 50 51 virtual bool IsDoubleBuffered() const override; 52 53 virtual bool SwapBuffers() override; 54 55 virtual void GetWSIInfo(nsCString* const out) const override; 56 57 virtual GLuint GetDefaultFramebuffer() override { return mBackbufferFB; } 58 59 private: 60 GLuint mBackbufferRB = 0; 61 GLuint mBackbufferFB = 0; 62 }; 63 64 } // namespace gl 65 } // namespace mozilla 66 67 #endif // GLCONTEXTEAGL_H_