-
-
Notifications
You must be signed in to change notification settings - Fork 35.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proper way to release context of a renderer immediately? #27100
Comments
There's no way to explicitly dispose of a WebGL context. The |
I understand the theory. In practice though, |
#26666 would actually add In general, it was never clear to me how
When I read this, it seems okay to use the method for "cleanup" operations and not just for simulating a context loss. I'm okay with adding |
Oh interesting - I hadn't seen this. The use of the word "simulating" in the spec is confusing, then, and at odds with this statement. |
@hybridherbst Would you be willing to file a PR that adds the |
Description
I'm running into a case where (currently) multiple renderers are used for GPU texture readback.
(see https://github.com/mrdoob/three.js/blob/834d77de4055ee81afa78ad8141447460501daf5/examples/jsm/utils/TextureUtils.js#L61C11-L61C11).
I understand that the better way would be to pass a renderer into the method; however, I'd like to learn more about improving the current default behaviour.
While debugging some cases where I'm getting context losses:
I noticed that calling
renderer.forceContextLoss
prevents there being too many contexts. Even with hundreds of renderers being created quickly after each other, there's no context loss, which is a much better behaviour.My understanding was (and the docs say so) that
forceContextLoss
basically simulates losing the context – and shouldn't be used to clean up resources. The practical effect does, in fact, seem to be fully cleaning up the renderer and avoiding side effects.So the question is:
Reproduction steps
Repeatedly call
TextureUtils.decompress
, e.g. 20 times in a loop.Code
Live example
Screenshots
No response
Version
latest
Device
No response
Browser
No response
OS
No response
The text was updated successfully, but these errors were encountered: