Bug 1760967 [wpt PR 33319] - Pin remaining dependencies in tools/ci/requirements_buil...
[gecko.git] / gfx / gl / GLContextEAGL.h
blob851a9170f7cb74c5be9dc1fc37472ff1ec555e93
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/. */
7 #ifndef GLCONTEXTEAGL_H_
8 #define GLCONTEXTEAGL_H_
10 #include "GLContext.h"
12 #include <CoreGraphics/CoreGraphics.h>
13 #include <OpenGLES/EAGL.h>
15 namespace mozilla {
16 namespace gl {
18 class GLContextEAGL : public GLContext {
19 friend class GLContextProviderEAGL;
21 EAGLContext* const mContext;
23 public:
24 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextEAGL, override)
25 GLContextEAGL(const GLContextDesc&, EAGLContext* context,
26 GLContext* sharedContext, ContextProfile profile);
28 ~GLContextEAGL();
30 virtual GLContextType GetContextType() const override {
31 return GLContextType::EAGL;
34 static GLContextEAGL* Cast(GLContext* gl) {
35 MOZ_ASSERT(gl->GetContextType() == GLContextType::EAGL);
36 return static_cast<GLContextEAGL*>(gl);
39 bool AttachToWindow(nsIWidget* aWidget);
41 EAGLContext* GetEAGLContext() const { return mContext; }
43 virtual bool MakeCurrentImpl() const override;
45 virtual bool IsCurrentImpl() const override;
47 Maybe<SymbolLoader> GetSymbolLoader() const override;
49 virtual bool IsDoubleBuffered() const override;
51 virtual bool SwapBuffers() override;
53 virtual void GetWSIInfo(nsCString* const out) const override;
55 virtual GLuint GetDefaultFramebuffer() override { return mBackbufferFB; }
57 virtual bool RenewSurface(nsIWidget* aWidget) override {
58 // FIXME: should use the passed widget instead of the existing one.
59 return RecreateRB();
62 private:
63 GLuint mBackbufferRB = 0;
64 GLuint mBackbufferFB = 0;
66 void* mLayer = nullptr;
68 bool RecreateRB();
71 } // namespace gl
72 } // namespace mozilla
74 #endif // GLCONTEXTEAGL_H_