diff options
Diffstat (limited to 'src/mbgl/gl/texture_pool.hpp')
-rw-r--r-- | src/mbgl/gl/texture_pool.hpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/mbgl/gl/texture_pool.hpp b/src/mbgl/gl/texture_pool.hpp index f68ca2eeaa..0992b8398d 100644 --- a/src/mbgl/gl/texture_pool.hpp +++ b/src/mbgl/gl/texture_pool.hpp @@ -3,20 +3,36 @@ #include <mbgl/util/noncopyable.hpp> #include <mbgl/gl/gl.hpp> +#include <mbgl/gl/gl_object_store.hpp> -#include <set> +#include <algorithm> +#include <memory> +#include <vector> namespace mbgl { namespace gl { class TexturePool : private util::noncopyable { - public: GLuint getTextureID(); - void removeTextureID(GLuint texture_id); + void releaseTextureID(GLuint); private: - std::set<GLuint> texture_ids; + class Impl : private util::noncopyable { + public: + Impl() : ids(gl::TexturePoolHolder::TextureMax) { + pool.create(); + std::copy(pool.getIDs().begin(), pool.getIDs().end(), ids.begin()); + } + + Impl(Impl&& o) : pool(std::move(o.pool)), ids(std::move(o.ids)) {} + Impl& operator=(Impl&& o) { pool = std::move(o.pool); ids = std::move(o.ids); return *this; } + + gl::TexturePoolHolder pool; + std::vector<GLuint> ids; + }; + + std::vector<Impl> pools; }; } // namespace gl |