summaryrefslogtreecommitdiff
path: root/src/mbgl/util/gl_object_store.hpp
blob: 775d4d1d01291686dd33d3dc20b77db0c05e0e98 (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
#ifndef MBGL_MAP_UTIL_GL_OBJECT_STORE
#define MBGL_MAP_UTIL_GL_OBJECT_STORE

#include <mbgl/platform/gl.hpp>
#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(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 util
} // namespace mbgl

#endif