question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Unloading' a render texture from the GPU means it cannot be rendered again

See original GitHub issue

Expected 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

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:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
themoonratcommented, Feb 5, 2021

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

1reaction
GoodBoyDigitalcommented, Jan 26, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'Unloading' a render texture from the GPU means it cannot be ...
Calling 'unload' on a render texture should remove it from GPU memory, but not from RAM, so if the renderer requires it again,...
Read more >
Stress on GPU if I change the texture value of material every ...
Every frame a GPU renders is essentially treated as a fully unique "thing", so you could change the texture every object in the...
Read more >
How To FIX Textures Not Loading Properly in Fortnite ...
Today we go over fixes for Fortnite textures that aren't loading/ rendering properly in fortnite, mostly it's attributed to Performance mode ...
Read more >
In Unity, how to remove a RenderTexture from memory when ...
The texture itself is not destroyed, and will be automatically created again when being used. The documentation for RenderTexture.
Read more >
Memory Usage Optimizations for CPU rendering
This article provides detailed information on how to handle projects with Excessive Memory (RAM) Consumption which might increase render...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found