Mir
gl_program_family.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU 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 General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
17  */
18 
19 #ifndef MIR_COMPOSITOR_GL_PROGRAM_FAMILY_H_
20 #define MIR_COMPOSITOR_GL_PROGRAM_FAMILY_H_
21 
22 #include <GLES2/gl2.h>
23 #include <utility>
24 #include <map>
25 #include <unordered_map>
26 
27 namespace mir { namespace compositor {
28 
38 {
39 public:
40  GLProgramFamily() = default;
41  GLProgramFamily(GLProgramFamily const&) = delete;
42  GLProgramFamily& operator=(GLProgramFamily const&) = delete;
43  ~GLProgramFamily() noexcept;
44 
45  GLuint add_program(const GLchar* const static_vshader_src,
46  const GLchar* const static_fshader_src);
47 
48 private:
49  struct Shader
50  {
51  GLuint id = 0;
52  void init(GLenum type, const GLchar* src);
53  };
54  typedef std::unordered_map<const GLchar*, Shader> ShaderMap;
55  ShaderMap vshader, fshader;
56 
57  typedef std::pair<GLuint, GLuint> ShaderPair;
58  struct Program
59  {
60  GLuint id = 0;
61  };
62  std::map<ShaderPair, Program> program;
63 };
64 
65 }} // namespace mir::compositor
66 
67 #endif // MIR_COMPOSITOR_GL_PROGRAM_FAMILY_H_
All things Mir.
Definition: buffer_stream.h:37
GLProgramFamily represents a set of GLSL programs that are closely related.
Definition: gl_program_family.h:37
GLProgramFamily & operator=(GLProgramFamily const &)=delete
~GLProgramFamily() noexcept
Definition: gl_program_family.cpp:50
MirSurfaceType type
Definition: mir_surface.h:448
GLuint add_program(const GLchar *const static_vshader_src, const GLchar *const static_fshader_src)
Definition: gl_program_family.cpp:75

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Mar 24 16:15:19 UTC 2015