X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fgraphics%2Fprogram_family.h;fp=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fgraphics%2Fprogram_family.h;h=4de720e941ac57f6bd2550306c07986e32e34130;hb=e26c1ec581be598521517829adba8c8dd23a768f;hp=0000000000000000000000000000000000000000;hpb=6699c1aea74eeb0eb400e6299079f0c7576f716f;p=iec.git diff --git a/src/type3_AndroidCloud/anbox-master/src/anbox/graphics/program_family.h b/src/type3_AndroidCloud/anbox-master/src/anbox/graphics/program_family.h new file mode 100644 index 0000000..4de720e --- /dev/null +++ b/src/type3_AndroidCloud/anbox-master/src/anbox/graphics/program_family.h @@ -0,0 +1,65 @@ +/* + * Copyright © 2015 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authored by: Daniel van Vugt + */ + +#ifndef ANBOX_GRAPHICS_PROGRAM_FAMILY_H_ +#define ANBOX_GRAPHICS_PROGRAM_FAMILY_H_ + +#include +#include +#include + +#include + +namespace anbox { +namespace graphics { +/** + * ProgramFamily represents a set of GLSL programs that are closely + * related. Programs which point to the same shader source strings will be + * made to share the same compiled shader objects. + * A secondary intention is that this class may be extended to allow the + * different programs within the family to share common patterns of uniform + * usage too. + */ +class ProgramFamily { + public: + ProgramFamily() = default; + ProgramFamily(ProgramFamily const&) = delete; + ProgramFamily& operator=(ProgramFamily const&) = delete; + ~ProgramFamily() noexcept; + + GLuint add_program(const GLchar* const static_vshader_src, + const GLchar* const static_fshader_src); + + private: + struct Shader { + GLuint id = 0; + void init(GLenum type, const GLchar* src); + }; + typedef std::unordered_map ShaderMap; + ShaderMap vshader, fshader; + + typedef std::pair ShaderPair; + struct Program { + GLuint id = 0; + }; + std::map program; +}; +} // namespace graphics +} // namespace anbox + +#endif // MIR_RENDERER_GL_PROGRAM_FAMILY_H_