
Description
Describe the bug
When loading a GLTF model that reuses the same texture across different material properties (e.g., the same texture used for both baseColorMap and occlusionMap), an assertion fails in Debug builds. The assertion assert_invariant(info.bindings.size() == 0 || info.flags == flags)
in the texture loading code triggers when attempting to bind the same texture with different usage flags.
To Reproduce
Steps to reproduce the behavior:
- Use Filament's GLTF viewer in Debug build
- Load the attached VirtualCity.glb which reuses the same texture image for different material properties
- Assertion triggers during texture binding phase
Expected behavior
The same texture should be able to be used across different material properties without triggering an assertion, as this is valid according to the GLTF specification.
Logs
FEngine (64 bits) created at 0000020AD3882660 (threading is enabled)
Vulkan device driver: NVIDIA 566.36
Selected physical device 'NVIDIA GeForce RTX 3050 Laptop GPU' from 2 physical devices. (vendor 0x10de, device 0x25a2, driver 0x8d890000, api 1.3)
Backend feature level: 3
FEngine feature level: 3
Requested linear format but KTX contains a sRGB format.
Requested linear format but KTX contains a sRGB format.
Texture Decoder has 18 background threads.
vkCreateSwapchain: 1024x640, VK_FORMAT_B8G8R8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, swapchain-size=3, identity-transform=true, depth=VK_FORMAT_D32_SFLOAT_S8_UINT, protected=false
PanicLog
in void __cdecl utils::panic(const char *,const char *,int,const char *) noexcept:34
in file [...]/filament/libs/utils/src/debug.cpp
reason: [...]/filament/libs/gltfio/src/FilamentAsset.cpp:119: failed assertion 'info.bindings.size() == 0 || info.flags == flags'
Desktop (please complete the following information):
- OS: Windows 11
- GPU: NVIDIA GeForce RTX 3050 Laptop GPU
- Backend: Vulkan