diff options
Diffstat (limited to 'src/mbgl/gl/gl_object_store.hpp')
-rw-r--r-- | src/mbgl/gl/gl_object_store.hpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mbgl/gl/gl_object_store.hpp b/src/mbgl/gl/gl_object_store.hpp new file mode 100644 index 0000000000..ac8ddd2748 --- /dev/null +++ b/src/mbgl/gl/gl_object_store.hpp @@ -0,0 +1,34 @@ +#ifndef MBGL_MAP_UTIL_GL_OBJECT_STORE +#define MBGL_MAP_UTIL_GL_OBJECT_STORE + +#include <mbgl/gl/gl.hpp> +#include <mbgl/util/noncopyable.hpp> + +#include <vector> + +namespace mbgl { +namespace gl { + +class GLObjectStore : private util::noncopyable { +public: + GLObjectStore() = default; + + // Mark OpenGL objects for deletion + void abandonVAO(GLuint vao); + void abandonBuffer(GLuint buffer); + void abandonTexture(GLuint 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<GLuint> abandonedVAOs; + std::vector<GLuint> abandonedBuffers; + std::vector<GLuint> abandonedTextures; +}; + +} // namespace gl +} // namespace mbgl + +#endif |