summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/texture_pool.hpp
blob: 1cdcdf220c2f589b0d8464032604442802ef20fb (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
#pragma once

#include <mbgl/util/noncopyable.hpp>
#include <mbgl/gl/gl.hpp>
#include <mbgl/gl/object_store.hpp>

#include <unique_resource.hpp>

#include <memory>

namespace mbgl {
namespace gl {

class TexturePool;

struct TextureReleaser {
    TexturePool* pool;
    void operator()(GLuint) const;
};

using PooledTexture = std_experimental::unique_resource<GLuint, TextureReleaser>;

class TexturePool : private util::noncopyable {
public:
    TexturePool();
    ~TexturePool();

    PooledTexture acquireTexture(gl::ObjectStore&);

private:
    friend TextureReleaser;

    class Impl;
    const std::unique_ptr<Impl> impl;
};

} // namespace gl
} // namespace mbgl