[Scene3D] Cache image load result so models can share it. 88/298188/15
authorEunki Hong <eunkiki.hong@samsung.com>
Sun, 3 Sep 2023 06:05:44 +0000 (15:05 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Tue, 12 Sep 2023 14:09:34 +0000 (23:09 +0900)
commit8d1310981009027c13eaa1c46600955e60508c7c
tree9650674cb6ccc44632d1bd46b003d4b45cab4722
parent5e8e014af6d954c797f400fb89361588c32bf41a
[Scene3D] Cache image load result so models can share it.

Let we cache the PixelData and Texture so various models can use it.

We cache the model resources, and let we use them same resources.
But if some seperated models using same images, we cannot cache about it.

There are relative usecase occured + Unity support this kind of cache system,
let we also cache images + textures locally.

---

First, we can cache url --> PixelData.
This caching might occured on multi threading system. So we have to lock the mutex
when we try to access this kind of pixeldata access.

Second, we can cache PixelData --> Texture.
This caching should be occured only for main thread.

---

We support Garbage Collect system to avoid full-iterating cached resources.
During GC, we should remove Texture first, and then PixelData.
(Since PixelData can be the key of Texture.)

Currenly, we will call GC only of ModelCache reference count become 0.

Change-Id: I5e89f214593503fa9e8b2290c3859f2674ff7048
Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
14 files changed:
automated-tests/resources/AnimatedCube2.gltf [new file with mode: 0644]
automated-tests/resources/AnimatedCube2.metadata [new file with mode: 0644]
automated-tests/resources/AnimatedCube3.gltf [new file with mode: 0644]
automated-tests/src/dali-scene3d-internal/utc-Dali-ModelCacheManager.cpp
automated-tests/src/dali-scene3d/utc-Dali-Model.cpp
dali-scene3d/internal/common/image-resource-loader.cpp [new file with mode: 0644]
dali-scene3d/internal/common/image-resource-loader.h [new file with mode: 0644]
dali-scene3d/internal/common/model-cache-manager.cpp
dali-scene3d/internal/file.list
dali-scene3d/internal/model-components/model-primitive-impl.cpp
dali-scene3d/public-api/loader/environment-definition.cpp
dali-scene3d/public-api/loader/environment-map-data.cpp
dali-scene3d/public-api/loader/environment-map-loader.cpp
dali-scene3d/public-api/loader/material-definition.cpp