From 2ec2860ce5de2bde751086db13de1c09e643c28c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 28 Sep 2016 17:21:20 +0200 Subject: [core] move OpenGL extension loading to their own headers --- include/mbgl/gl/gl.hpp | 47 +++-------------------------------------------- 1 file changed, 3 insertions(+), 44 deletions(-) (limited to 'include/mbgl/gl') diff --git a/include/mbgl/gl/gl.hpp b/include/mbgl/gl/gl.hpp index c849a935c2..a499d731d6 100644 --- a/include/mbgl/gl/gl.hpp +++ b/include/mbgl/gl/gl.hpp @@ -1,8 +1,6 @@ #pragma once -#include #include -#include #if __APPLE__ #include "TargetConditionals.h" @@ -38,51 +36,12 @@ struct Error : std::runtime_error { void checkError(const char *cmd, const char *file, int line); +} // namespace gl +} // namespace mbgl + #ifndef NDEBUG #define MBGL_CHECK_ERROR(cmd) ([&]() { struct __MBGL_C_E { ~__MBGL_C_E() { ::mbgl::gl::checkError(#cmd, __FILE__, __LINE__); } } __MBGL_C_E; return cmd; }()) #else #define MBGL_CHECK_ERROR(cmd) (cmd) #endif -class ExtensionFunctionBase { -public: - static std::vector& functions(); - typedef std::pair Probe; - std::vector probes; - void (*ptr)(); -}; - -template -class ExtensionFunction; - -template -class ExtensionFunction : protected ExtensionFunctionBase { -public: - ExtensionFunction(std::initializer_list probes_) { - probes = probes_; - ExtensionFunctionBase::functions().push_back(this); - } - - explicit operator bool() const { - return ptr; - } - - R operator()(Args... args) const { - return (*reinterpret_cast(ptr))(std::forward(args)...); - } -}; - -using glProc = void (*)(); -void InitializeExtensions(glProc (*getProcAddress)(const char *)); - -extern ExtensionFunction - BindVertexArray; - -extern ExtensionFunction - DeleteVertexArrays; - -extern ExtensionFunction - GenVertexArrays; - -} // namespace gl -} // namespace mbgl -- cgit v1.2.1