summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam Hunter <adam@mapbox.com>2015-10-06 13:54:36 -0700
committerAdam Hunter <adam@mapbox.com>2015-10-06 13:54:36 -0700
commit1179096dd8aff05903edeb7cfe74ef323bfc5709 (patch)
treefa7dd8d622265dc85205342b44294ffdf10fd691 /include
parent402819e1add767c11e691f209fa642ab807cf883 (diff)
downloadqtlocation-mapboxgl-1179096dd8aff05903edeb7cfe74ef323bfc5709.tar.gz
VAO and extension tracking code.
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/platform/gl.hpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/mbgl/platform/gl.hpp b/include/mbgl/platform/gl.hpp
index 1e3f13427b..6c1229f6d1 100644
--- a/include/mbgl/platform/gl.hpp
+++ b/include/mbgl/platform/gl.hpp
@@ -7,6 +7,10 @@
#include <stdexcept>
#include <vector>
+#ifdef GL_TRACK
+#include <iostream>
+#endif
+
#if __APPLE__
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE
@@ -34,6 +38,28 @@
namespace mbgl {
namespace gl {
+#ifdef GL_TRACK
+ typedef void (*GLDEBUGPROC)(GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *message,
+ const void *userParam);
+
+ template <class... Args> void mbx_trapExtension(const char *name, Args... args);
+
+ void mbx_trapExtension(const char *);
+ void mbx_trapExtension(const char *, GLint, const char *);
+ void mbx_trapExtension(const char *, GLsizei, GLuint *);
+ void mbx_trapExtension(const char *, GLsizei, const GLuint *);
+ void mbx_trapExtension(const char *, GLenum, GLenum, GLenum, GLsizei, const GLuint *, GLboolean);
+ void mbx_trapExtension(const char *, GLenum, GLuint, GLsizei, const GLchar *);
+ void mbx_trapExtension(const char *, GLDEBUGPROC, const void *);
+ void mbx_trapExtension(const char *, GLuint, GLuint, GLuint, GLuint, GLint, const char *, const void*);
+ void mbx_trapExtension(const char *name, GLuint array);
+#endif
+
struct Error : ::std::runtime_error {
inline Error(GLenum err, const std::string &msg) : ::std::runtime_error(msg), code(err) {};
const GLenum code;
@@ -53,6 +79,9 @@ public:
typedef std::pair<const char *, const char *> Probe;
std::vector<Probe> probes;
void (*ptr)();
+#ifdef GL_TRACK
+ const char *foundName;
+#endif
};
template <class>
@@ -71,6 +100,9 @@ public:
}
R operator()(Args... args) const {
+#ifdef GL_TRACK
+ mbx_trapExtension(foundName, args...);
+#endif
return (*reinterpret_cast<R (*)(Args...)>(ptr))(std::forward<Args>(args)...);
}
};