Mir
gl_context.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013-2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_GRAPHICS_ANDROID_GL_CONTEXT_H_
20 #define MIR_GRAPHICS_ANDROID_GL_CONTEXT_H_
21 
24 #include "swapping_gl_context.h"
25 #include "mir_toolkit/common.h"
26 #include <functional>
27 
28 namespace mir
29 {
30 namespace graphics
31 {
32 class DisplayReport;
33 class GLConfig;
34 namespace android
35 {
36 
37 class FramebufferBundle;
38 
39 //helper base class that doesn't have an egl surface.
41 {
42 public:
43  ~GLContext();
44 
45 protected:
46  GLContext(MirPixelFormat display_format,
47  GLConfig const& gl_config,
48  DisplayReport& report);
49 
50  GLContext(GLContext const& shared_gl_context);
51 
52  void release_current() const override;
54  void make_current(EGLSurface) const;
55 
56  EGLDisplay const egl_display;
57  EGLConfig const egl_config;
59 
60 private:
61  bool const own_display;
62 };
63 
65 {
66 public:
67  PbufferGLContext(MirPixelFormat display_format,
68  GLConfig const& gl_config,
69  DisplayReport& report);
70 
71  PbufferGLContext(PbufferGLContext const& shared_gl_context);
72 
73  void make_current() const override;
74  void release_current() const override;
75 private:
76  EGLSurfaceStore const egl_surface;
77 };
78 
79 
81  public SwappingGLContext
82 {
83 public:
84  FramebufferGLContext(GLContext const& shared_gl_context,
85  std::shared_ptr<FramebufferBundle> const& fb_bundle,
86  std::shared_ptr<ANativeWindow> const& native_window);
87 
88  void make_current() const override;
89  void release_current() const override;
90  void swap_buffers() const override;
91  std::shared_ptr<Buffer> last_rendered_buffer() const override;
92 
93 private:
94  std::shared_ptr<FramebufferBundle> const fb_bundle;
95  EGLSurfaceStore const egl_surface;
96 };
97 
98 }
99 }
100 }
101 
102 #endif /* MIR_GRAPHICS_ANDROID_GL_CONTEXT_H_ */
Definition: display_report.h:29
All things Mir.
Definition: atomic_callback.h:25
Definition: gl_context.h:40
virtual void make_current() const =0
EGLConfig const egl_config
Definition: gl_context.h:57
Definition: swapping_gl_context.h:31
~GLContext()
Definition: gl_context.cpp:123
EGLContextStore const egl_context
Definition: gl_context.h:58
Interface for customizing aspects of the GL config used by the server.
Definition: gl_config.h:30
EGLDisplay const egl_display
Definition: gl_context.h:56
Definition: gl_context.h:64
Definition: egl_resources.h:29
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:134
Definition: android_input_receiver.h:36
void release_current() const override
Definition: gl_context.cpp:117
Definition: gl_context.h:27
Definition: egl_resources.h:47

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016