blob: 0992b8398d1320dd86e4f6b54574403f2e65b5cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#ifndef MBGL_UTIL_TEXTUREPOOL
#define MBGL_UTIL_TEXTUREPOOL
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/gl/gl.hpp>
#include <mbgl/gl/gl_object_store.hpp>
#include <algorithm>
#include <memory>
#include <vector>
namespace mbgl {
namespace gl {
class TexturePool : private util::noncopyable {
public:
GLuint getTextureID();
void releaseTextureID(GLuint);
private:
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
} // namespace mbgl
#endif
|