Drawable Renderer (#1570), Add uniform buffer destructor

This commit is contained in:
Tim Sylvester
2023-05-25 15:32:45 -07:00
committed by Bart Louwers
parent fc1f65e8ef
commit f2cc744710
2 changed files with 8 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ public:
: UniformBuffer(other) {}
UniformBufferGL(UniformBufferGL&& other)
: UniformBuffer(std::move(other)) {}
~UniformBufferGL() override;
BufferID getID() const { return id; }

View File

@@ -16,5 +16,12 @@ UniformBufferGL::UniformBufferGL(const void* data, std::size_t size_)
MBGL_CHECK_ERROR(glBindBuffer(GL_UNIFORM_BUFFER, 0));
}
UniformBufferGL::~UniformBufferGL() {
if (id) {
MBGL_CHECK_ERROR(glDeleteBuffers(1, &id));
id = 0;
}
}
} // namespace gl
} // namespace mbgl