Mir
default_program_factory.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 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: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17  */
18 
19 #ifndef MIR_GL_DEFAULT_PROGRAM_FACTORY_H_
20 #define MIR_GL_DEFAULT_PROGRAM_FACTORY_H_
21 
22 #include "program_factory.h"
23 #include <mutex>
24 
25 namespace mir
26 {
27 namespace gl
28 {
30 {
31 public:
32  std::unique_ptr<Program> create_gl_program(std::string const&, std::string const&) const override;
33  std::unique_ptr<TextureCache> create_texture_cache() const override;
34 
35 private:
36  /*
37  * We need to serialize renderer creation because some GL calls used
38  * during renderer construction that create unique resource ids
39  * (e.g. glCreateProgram) are not thread-safe when the threads are
40  * have the same or shared EGL contexts.
41  */
42  std::mutex mutable mutex;
43 };
44 }
45 }
46 
47 #endif /* MIR_GL_DEFAULT_PROGRAM_FACTORY_H_ */
All things Mir.
Definition: atomic_callback.h:25
std::unique_ptr< TextureCache > create_texture_cache() const override
Definition: default_program_factory.cpp:36
Definition: program_factory.h:31
Definition: default_program_factory.h:29
std::unique_ptr< Program > create_gl_program(std::string const &, std::string const &) const override
Definition: default_program_factory.cpp:27

Copyright © 2012-2015 Canonical Ltd.
Generated on Wed Mar 30 00:29:56 UTC 2016