From 3728f0660395d04d5735d85831a43480501f1c63 Mon Sep 17 00:00:00 2001 From: Balaji M Date: Fri, 12 Jul 2024 19:22:25 -0400 Subject: [PATCH] utility::loadCgltfBuffers is done once instead of doing for each primitive (#7969) --- libs/gltfio/src/extended/AssetLoaderExtended.cpp | 5 +++-- libs/gltfio/src/extended/AssetLoaderExtended.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/gltfio/src/extended/AssetLoaderExtended.cpp b/libs/gltfio/src/extended/AssetLoaderExtended.cpp index 17a2a672fcc..19ee1eed77a 100644 --- a/libs/gltfio/src/extended/AssetLoaderExtended.cpp +++ b/libs/gltfio/src/extended/AssetLoaderExtended.cpp @@ -525,8 +525,9 @@ bool AssetLoaderExtended::createPrimitive(Input* input, Output* out, slotCount++}; } - if (!utility::loadCgltfBuffers(gltf, mGltfPath.c_str(), mUriDataCache)) { - return false; + if (!mCgltfBuffersLoaded) { + mCgltfBuffersLoaded = utility::loadCgltfBuffers(gltf, mGltfPath.c_str(), mUriDataCache); + if (!mCgltfBuffersLoaded) return false; } utility::decodeDracoMeshes(gltf, prim, input->dracoCache); diff --git a/libs/gltfio/src/extended/AssetLoaderExtended.h b/libs/gltfio/src/extended/AssetLoaderExtended.h index 7af8054409c..a803fb4f132 100644 --- a/libs/gltfio/src/extended/AssetLoaderExtended.h +++ b/libs/gltfio/src/extended/AssetLoaderExtended.h @@ -83,6 +83,7 @@ struct AssetLoaderExtended { std::string mGltfPath; MaterialProvider& mMaterials; UriDataCacheHandle mUriDataCache; + bool mCgltfBuffersLoaded; }; } // namespace filament::gltfio