'Unloading' a render texture from the GPU means it cannot be rendered again
See original GitHub issueExpected Behavior
Calling ‘unload’ on a render texture should remove it from GPU memory, but not from RAM, so if the renderer requires it again, it’s re-uploaded to the GPU to be used.
Current Behavior
Calling ‘unload’ on a render texture will forever more make it unrenderable.
Steps to Reproduce
Create a sprite, and then a render texture from it using a basic pixi playground example and the ‘app’ class
Now try to call app.renderer.textureGC.unload(app.stage);
to remove all textures from the GPU memory. This works… but then of course the loaded texture is re-uploaded to the GPU as it needs to be rendered next frame. However, the render texture is just outright destroyed and won’t ever display again.
Environment
pixi.js
version: 5.3.7 and 6.0.0-rc3 (occurs from 5.3.0 onwards)- Running Example: https://www.pixiplayground.com/#/edit/Vjq-FFuXoo_rLCw5H1pIR
Started not working after https://github.com/pixijs/pixi.js/pull/6710/files#diff-c08d24f02b18b8fbbd0952b9e22ce1808a264f03e958eb52e9bc48fff9b4631e - but looks like that commit just fixed render textures never getting removed from gpu memory at all
Also goes wrong if you use ‘dispose’ directly on the base texture - https://www.pixiplayground.com/#/edit/YDdt-kspnsj2U9gemkmZw - whose documentation says * Frees the texture and framebuffer from WebGL memory without destroying this texture object. * This means you can still use the texture later which will upload it to GPU * memory again.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (6 by maintainers)
Top GitHub Comments
Looks like I was the one who fixed this last time I noticed this! 4 years back: https://github.com/pixijs/pixi.js/pull/3342 Putting up a PR I think covers this again
heya, this actually does look like a bug!
app.renderer.textureGC.unload(oldSceneContainer, true);
should not nuke any render textures at all.textureGC should manages regular image based (re-uploadable) textures only.