X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fgraphics%2Fgl_extensions.h;fp=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fgraphics%2Fgl_extensions.h;h=1b91e5f41e71f91186fcf23d725726f2aa25ee6b;hb=e26c1ec581be598521517829adba8c8dd23a768f;hp=0000000000000000000000000000000000000000;hpb=6699c1aea74eeb0eb400e6299079f0c7576f716f;p=iec.git diff --git a/src/type3_AndroidCloud/anbox-master/src/anbox/graphics/gl_extensions.h b/src/type3_AndroidCloud/anbox-master/src/anbox/graphics/gl_extensions.h new file mode 100644 index 0000000..1b91e5f --- /dev/null +++ b/src/type3_AndroidCloud/anbox-master/src/anbox/graphics/gl_extensions.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2017 Simon Fels + * + * 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 warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, 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 . + * + */ + +#ifndef ANBOX_GRAPHICS_GL_EXTENSIONS_H_ +#define ANBOX_GRAPHICS_GL_EXTENSIONS_H_ + +#include +#include + +namespace anbox { +namespace graphics { +class GLExtensions { + public: + GLExtensions(char const* extensions) : extensions{extensions} { + if (!extensions) + throw std::runtime_error("Couldn't get list of GL extensions"); + } + + bool support(char const* ext) const { + if (!ext) + throw std::invalid_argument("Invalid extension name"); + + char const* ext_ptr = extensions; + size_t const len = strlen(ext); + while ((ext_ptr = strstr(ext_ptr, ext)) != nullptr) { + if (ext_ptr[len] == ' ' || ext_ptr[len] == '\0') + break; + ext_ptr += len; + } + + return ext_ptr != nullptr; + } + + char const* raw() { return extensions; } + + private: + char const* extensions; +}; +} // namespace graphics +} // namespace anbox + +#endif