Provide explicit argument for asset cache ID.

This will allow assets to cache compiled results with different parameters. For example, we could cache both an RGB version of a texture and a Mono version.

PiperOrigin-RevId: 811341377
Change-Id: Ifd6a4ff88661a2b38be47c02d6a666de2c202885
This commit is contained in:
Sam Haves
2025-09-25 07:23:11 -07:00
committed by Copybara-Service
parent 0baac58999
commit 922aebbeed
5 changed files with 79 additions and 77 deletions
+2 -2
View File
@@ -91,7 +91,7 @@ PNGImage PNGImage::Load(const mjCBase* obj, mjResource* resource,
};
// try loading from cache
if (cache && cache->PopulateData(resource, callback)) {
if (cache && cache->PopulateData(resource->name, resource, callback)) {
return image;
}
@@ -139,7 +139,7 @@ PNGImage PNGImage::Load(const mjCBase* obj, mjResource* resource,
std::shared_ptr<const void> cached_data(cached_image, +[] (const void* data) {
delete static_cast<const PNGImage*>(data);
});
cache->Insert("", resource, cached_data, size);
cache->Insert("", resource->name, resource, cached_data, size);
}
return image;