xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/gl/egl/ContextEGL.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 //
2 // Copyright 2018 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // ContextEGL.h: Context class for GL on Android/ChromeOS.  Wraps a RendererEGL.
8 
9 #ifndef LIBANGLE_RENDERER_GL_EGL_CONTEXTEGL_H_
10 #define LIBANGLE_RENDERER_GL_EGL_CONTEXTEGL_H_
11 
12 #include "libANGLE/renderer/gl/ContextGL.h"
13 #include "libANGLE/renderer/gl/egl/RendererEGL.h"
14 
15 namespace rx
16 {
17 
18 struct ExternalContextState;
19 
20 class ContextEGL : public ContextGL
21 {
22   public:
23     ContextEGL(const gl::State &state,
24                gl::ErrorSet *errorSet,
25                const std::shared_ptr<RendererEGL> &renderer,
26                RobustnessVideoMemoryPurgeStatus robustnessVideoMemoryPurgeStatus);
27     ~ContextEGL() override;
28 
29     void acquireExternalContext(const gl::Context *context) override;
30     void releaseExternalContext(const gl::Context *context) override;
31 
32     EGLContext getContext() const;
33 
34   private:
35     std::shared_ptr<RendererEGL> mRendererEGL;
36     std::unique_ptr<ExternalContextState> mExtState;
37 
38     // Used to restore the default FBO's ID on unmaking an external context
39     // current, as when making an external context current ANGLE sets the
40     // default FBO's ID to that bound in the external context.
41     GLuint mPrevDefaultFramebufferID = 0;
42 };
43 }  // namespace rx
44 
45 #endif  // LIBANGLE_RENDERER_GL_EGL_RENDEREREGL_H_
46