DynamicTexture.setSize will now check to see if the glTexture bound to the current frame is stale, and if so, destroy it before binding the one from the Render Target. This fixes an issue where constantly destroy and creating Dynamic Textures would cause a memory leak in WebGL. Fix #6669

This commit is contained in:
Richard Davey 2024-01-31 18:12:51 +00:00
parent ab6776e69f
commit 97967288b6

View file

@ -269,7 +269,10 @@ var DynamicTexture = new Class({
if (renderTarget.willResize(width, height))
{
renderTarget.resize(width, height);
}
if (renderTarget.texture !== source.glTexture)
{
// The WebGLTexture has been resized, so is new, so we need to delete the old one
this.renderer.deleteTexture(source.glTexture);
}