Fix material instance check log when destroying material

When the feature flags assert_destroy_material_before_material_instance
is disabled, we emit a log instead of an assert. Unfortunately this log
would be emitted even when all material instances were destroyed.
This commit is contained in:
Mathias Agopian
2025-03-10 14:10:24 -07:00
committed by Mathias Agopian
parent 34ebe45e2a
commit 4f8080ead2

View File

@@ -388,12 +388,13 @@ void FMaterial::terminate(FEngine& engine) {
<< "destroying material \"" << this->getName().c_str_safe() << "\" but "
<< pos->second.size() << " instances still alive.";
} else {
utils::slog.e << "destroying material \"" << this->getName().c_str_safe() << "\" but "
<< pos->second.size() << " instances still alive.";
if (UTILS_UNLIKELY(!pos->second.empty())) {
slog.e << "destroying material \"" << this->getName().c_str_safe() << "\" but "
<< pos->second.size() << " instances still alive." << io::endl;
}
}
}
#if FILAMENT_ENABLE_MATDBG
// Unregister the material with matdbg.
matdbg::DebugServer* server = engine.debug.server;