You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If any LightSource that uses a shadowmask texture is later-on modified on any of its properties, the texture promise gets re-created and leaks memory heavily.
There's a different problem with LightSource and raw texture compression (only enabled on MacOS) in which during local scene development (no asset bundles) shadow mask textures are failing to be compressed in runtime and so they don't work during Local Scene Development, so there's no memory leak in that case due to that other bug.
The shadowmask has to be visible for it to leak, like:
Ideas for solution (the texture asset promise is being handled in a wrong), we should:
Either:
Use TryGetResult() instead of TryConsume() at ResolveTexturePromise() to actually keep the used promise at lightSourceComponent.TextureMaskPromise to be compared inside TryCreateGetTexturePromise() based on its loadingIntention or similar (and avoid returning false at if (TextureComponentUtils.Equals(ref textureComponentValue, ref promise)) which makes it create a new promise for the texture that was already loaded but consumed...). That would be similar as what it's being done for Material systems when keeping the promise at CreateMaterialSystemBase.
Keep using TryConsume() but storing the loadingIntention or the file hash in a new prop at LightSourceComponent to be compared at TryCreateGetTexturePromise() and avoid re-creating the promise when dealing with the same loading intention.
Improve the promise cleanup to use ForgetLoading(World) and Consume(World) depending on the previous suggested approaches selection
The text was updated successfully, but these errors were encountered:
If any LightSource that uses a shadowmask texture is later-on modified on any of its properties, the texture promise gets re-created and leaks memory heavily.
test-scene that showcases the problem by just running the scene and being inside it: https://github.com/decentraland-scenes/light-memory-leak-test
There's a different problem with LightSource and raw texture compression (only enabled on MacOS) in which during local scene development (no asset bundles) shadow mask textures are failing to be compressed in runtime and so they don't work during Local Scene Development, so there's no memory leak in that case due to that other bug.
The shadowmask has to be visible for it to leak, like:
Lightsource-2.mp4
First attempt at fixing the issue is not enough and should be continued: decentraland/unity-explorer#3492.
Ideas for solution (the texture asset promise is being handled in a wrong), we should:
TryGetResult()
instead ofTryConsume()
atResolveTexturePromise()
to actually keep the used promise atlightSourceComponent.TextureMaskPromise
to be compared insideTryCreateGetTexturePromise()
based on itsloadingIntention
or similar (and avoid returning false atif (TextureComponentUtils.Equals(ref textureComponentValue, ref promise))
which makes it create a new promise for the texture that was already loaded but consumed...). That would be similar as what it's being done for Material systems when keeping the promise atCreateMaterialSystemBase
.TryConsume()
but storing theloadingIntention
or the file hash in a new prop atLightSourceComponent
to be compared atTryCreateGetTexturePromise()
and avoid re-creating the promise when dealing with the same loading intention.ForgetLoading(World)
andConsume(World)
depending on the previous suggested approaches selectionThe text was updated successfully, but these errors were encountered: