* validate MaterialInstance references when destroyed With this change we now enforce two things: - All MaterialInstance of a Material must be destroyed when destroying said Material. This has always been a documented requirement of the public API, but wasn't enforced (only a warning was printed). This new assertion is unconditional. - A MaterialInstance, when destroyed is no longer in use by any Renderable. So before destroying a MaterialInstance, the user of API needs to ensure that either all Renderable using that MaterialInstance in one of their Render Primitives are destroyed, or, that these Renderable using that MaterialInstance are reset to another one or to null. There is a new RenderableManager::clearMaterialInstanceAt() that can be used to clear a MaterialInstance on a Render Primitive. Additionally, a Render Primitive with a null MaterialInstance is now silently skipped during rendering, instead of a null-dereference. Finally, that second assert is protected by a new feature flag: "features.engine.debug.assert_material_instance_in_use". This flag is enabled on DEBUG builds and disabled on RELEASE builds by default. The flag can be changed at any time using `Engine::setFeatureFlag()`. BUGS=[333907416] * Update filament/src/components/RenderableManager.cpp Co-authored-by: Powei Feng <powei@google.com> --------- Co-authored-by: Powei Feng <powei@google.com>
Description
gltfio is a loader library that consumes gltf or glb content and produces Filament
objects. For usage details, see the docstring for AssetLoader.
gltfio has two plug-in interfaces, TextureProvider and MaterialProvider. Filament ships with
several ready-to-go implementations described below.
MaterialProvidercreates Filament materials in response to certain glTF requirements.- UbershaderProvider loads pre-built materials.
JitShaderProviderbuilds materials at run time using thefilamatlibrary.
TextureProvidercreates and populates FilamentTextureobjects.StbProvideruses the STB library to read PNG and JPEG files.Ktx2Provideruses the BasisU library to read KTX2 files.
UbershaderProvider
UbershaderProvider is a ready-to-go implementation of the MaterialProvider interface that should
be used in applications that need fast startup times. There is no material compilation that
occurs at run time, but the shaders might be relatively large and complex.
At load time, the ubershader loader consumes an ubershader archive which is a precompiled set of materials bundled with formal descriptions of the glTF features that they support.
The uberz command line tool consumes a list of .spec and .filamat files and produces a single
.uberz file. For details on these two file formats, see the README in libs/uberz.