summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-09-28 17:21:20 +0200
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-09-29 13:19:27 -0700
commit2ec2860ce5de2bde751086db13de1c09e643c28c (patch)
treed9539718dde07e3ddeaf2b502032828157a25e27 /include
parentcc78b74098e02311cc646fe5b82c13641ff705fa (diff)
downloadqtlocation-mapboxgl-2ec2860ce5de2bde751086db13de1c09e643c28c.tar.gz
[core] move OpenGL extension loading to their own headers
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/gl/gl.hpp47
-rw-r--r--include/mbgl/platform/default/headless_view.hpp1
2 files changed, 4 insertions, 44 deletions
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 <string>
#include <stdexcept>
-#include <vector>
#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<ExtensionFunctionBase*>& functions();
- typedef std::pair<const char *, const char *> Probe;
- std::vector<Probe> probes;
- void (*ptr)();
-};
-
-template <class>
-class ExtensionFunction;
-
-template <class R, class... Args>
-class ExtensionFunction<R (Args...)> : protected ExtensionFunctionBase {
-public:
- ExtensionFunction(std::initializer_list<Probe> probes_) {
- probes = probes_;
- ExtensionFunctionBase::functions().push_back(this);
- }
-
- explicit operator bool() const {
- return ptr;
- }
-
- R operator()(Args... args) const {
- return (*reinterpret_cast<R (*)(Args...)>(ptr))(std::forward<Args>(args)...);
- }
-};
-
-using glProc = void (*)();
-void InitializeExtensions(glProc (*getProcAddress)(const char *));
-
-extern ExtensionFunction<void (GLuint array)>
- BindVertexArray;
-
-extern ExtensionFunction<void (GLsizei n, const GLuint* arrays)>
- DeleteVertexArrays;
-
-extern ExtensionFunction<void (GLsizei n, GLuint* arrays)>
- GenVertexArrays;
-
-} // namespace gl
-} // namespace mbgl
diff --git a/include/mbgl/platform/default/headless_view.hpp b/include/mbgl/platform/default/headless_view.hpp
index baa6a0382c..23f1e8251a 100644
--- a/include/mbgl/platform/default/headless_view.hpp
+++ b/include/mbgl/platform/default/headless_view.hpp
@@ -23,6 +23,7 @@ typedef XID GLXPbuffer;
#include <mbgl/mbgl.hpp>
#include <mbgl/gl/gl.hpp>
#include <mbgl/gl/types.hpp>
+#include <mbgl/gl/extension.hpp>
#include <memory>
#include <thread>