summaryrefslogtreecommitdiff
path: root/src/mbgl/util/gl_object_store.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/util/gl_object_store.hpp')
-rw-r--r--src/mbgl/util/gl_object_store.hpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mbgl/util/gl_object_store.hpp b/src/mbgl/util/gl_object_store.hpp
new file mode 100644
index 0000000000..925ac1c05d
--- /dev/null
+++ b/src/mbgl/util/gl_object_store.hpp
@@ -0,0 +1,34 @@
+#ifndef MBGL_MAP_UTIL_GL_OBJECT_STORE
+#define MBGL_MAP_UTIL_GL_OBJECT_STORE
+
+#include <mbgl/util/noncopyable.hpp>
+
+#include <cstdint>
+#include <vector>
+
+namespace mbgl {
+namespace util {
+
+class GLObjectStore : private util::noncopyable {
+public:
+ GLObjectStore() = default;
+
+ // Mark OpenGL objects for deletion
+ void abandonVAO(uint32_t vao);
+ void abandonBuffer(uint32_t buffer);
+ void abandonTexture(uint32_t texture);
+
+ // Actually remove the objects we marked as abandoned with the above methods.
+ // Only call this while the OpenGL context is exclusive to this thread.
+ void performCleanup();
+
+private:
+ std::vector<uint32_t> abandonedVAOs;
+ std::vector<uint32_t> abandonedBuffers;
+ std::vector<uint32_t> abandonedTextures;
+};
+
+}
+}
+
+#endif