From b1ba1f076d3e8b4295b1afac94e95ff8a846e619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 4 Feb 2024 20:55:36 +0100 Subject: [PATCH] GL: properly destroy a mesh VAO. Whoops, this got silently omitted during the massive refactor in f7a6d79aa07cb81c6170d7ab98d0a01856f3f16a (Nov 23). Buffers *do* get destroyed, VAOs not. If you got sudden GPU memory usage issues after a recent Magnum update, this was why. --- doc/changelog.dox | 2 ++ src/Magnum/GL/Mesh.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/doc/changelog.dox b/doc/changelog.dox index 0012a599b..5654acdf3 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -1035,6 +1035,8 @@ See also: @ref GL::Buffer::bind() call as affecting also the regular binding point, leading to wrong buffer object being used for data upload etc. in certain cases on platforms without DSA extensions. +- A large refactor of @ref GL::Mesh internals caused VAOs to no longer be + correctly deleted on destruction (see [mosra/magnum#632](https://github.com/mosra/magnum/issues/632)) - @ref GL::Context move constructor was not marked @cpp noexcept @ce by accident and it was also not really moving everything properly, especially when delayed creation was done on the moved-to object diff --git a/src/Magnum/GL/Mesh.cpp b/src/Magnum/GL/Mesh.cpp index 839a5d5b1..5d746a95c 100644 --- a/src/Magnum/GL/Mesh.cpp +++ b/src/Magnum/GL/Mesh.cpp @@ -344,6 +344,8 @@ Mesh::~Mesh() { /* Remove current vao from the state */ GLuint& current = Context::current().state().mesh.currentVAO; if(current == _id) current = 0; + + Context::current().state().mesh.destroyImplementation(*this); } Mesh::Mesh(Mesh&& other) noexcept: _id(other._id), _primitive(other._primitive), _flags{other._flags}, _countSet{other._countSet}, _count(other._count), _baseVertex{other._baseVertex}, _instanceCount{other._instanceCount},