OpenGLRenderer: Fix buffer destruction not removing VAOs referencing it

This commit is contained in:
Jérôme Leclercq 2021-10-19 14:48:53 +02:00
parent 7e65f4b544
commit 6162a805e4
3 changed files with 4 additions and 2 deletions

View File

@ -61,7 +61,7 @@ namespace Nz::GL
OpenGLVaoCache& operator=(OpenGLVaoCache&&) = delete;
private:
void NotifyBufferDestruction(GLuint buffer);
void NotifyBufferDestruction(GLuint buffer) const;
mutable std::unordered_map<OpenGLVaoSetup, std::unique_ptr<VertexArray>, OpenGLVaoSetupHasher> m_vertexArrays;
Context& m_context;

View File

@ -58,6 +58,8 @@ namespace Nz::GL
if (boundBuffer == buffer)
boundBuffer = 0;
}
m_vaoCache.NotifyBufferDestruction(buffer);
}
inline void Context::NotifyFramebufferDestruction(GLuint fbo) const

View File

@ -54,7 +54,7 @@ namespace Nz::GL
return *(it->second);
}
void OpenGLVaoCache::NotifyBufferDestruction(GLuint buffer)
void OpenGLVaoCache::NotifyBufferDestruction(GLuint buffer) const
{
for (auto it = m_vertexArrays.begin(); it != m_vertexArrays.end();)
{