mgsx-dev/gdx-gltf

Shared managed textures (AssetManager)

Hangman opened this issue · 1 comments

There seems to be an issue with managed textures that are shared between different models.
Let's say model A and B do share a texture, now when model A is disposed, the shared texture is also disposed as if it's reference count is 0 where it should be 1. Textures of models should be ref counted, right? So I consider this a bug.

I'm not too sure if this is a bug in gdx-gltf or libgdx though but since you're a libgdx contributor it's probably better to start here and go down to libgdx if necessary.

I've tried to understand the ManagedTextureResolver and it's interaction with the asset manager and failed gloriously.
Nevertheless, here's a runnable demonstration: https://github.com/Hangman/texture-resolver-test
Warning: gradle 7 is used, not ancient 2.1 :P If you run into any problems due to this... deleting the gradle cache worked for me.

@Hangman indeed there was a missing. Thank you for the detailed issue ;-)