Mir
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_RENDERER_GL_PROGRAM_FAMILY_H_
20 #define MIR_RENDERER_GL_PROGRAM_FAMILY_H_
21 
22 #include MIR_SERVER_GL_H
23 #include <utility>
24 #include <map>
25 #include <unordered_map>
26 
27 namespace mir
28 {
29 namespace renderer
30 {
31 namespace gl
32 {
33 
43 {
44 public:
45  ProgramFamily() = default;
46  ProgramFamily(ProgramFamily const&) = delete;
47  ProgramFamily& operator=(ProgramFamily const&) = delete;
48  ~ProgramFamily() noexcept;
49 
50  GLuint add_program(const GLchar* const static_vshader_src,
51  const GLchar* const static_fshader_src);
52 
53 private:
54  struct Shader
55  {
56  GLuint id = 0;
57  void init(GLenum type, const GLchar* src);
58  };
59  typedef std::unordered_map<const GLchar*, Shader> ShaderMap;
60  ShaderMap vshader, fshader;
61 
62  typedef std::pair<GLuint, GLuint> ShaderPair;
63  struct Program
64  {
65  GLuint id = 0;
66  };
67  std::map<ShaderPair, Program> program;
68 };
69 
70 }
71 }
72 }
73 
74 #endif // MIR_RENDERER_GL_PROGRAM_FAMILY_H_
All things Mir.
Definition: atomic_callback.h:25
ProgramFamily & operator=(ProgramFamily const &)=delete
~ProgramFamily() noexcept
Definition: program_family.cpp:56
ProgramFamily represents a set of GLSL programs that are closely related.
Definition: program_family.h:42
GLuint add_program(const GLchar *const static_vshader_src, const GLchar *const static_fshader_src)
Definition: program_family.cpp:81

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