Skip to content

Commit 4f8080e

Browse files
committed
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.
1 parent 34ebe45 commit 4f8080e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

filament/src/details/Material.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,13 @@ void FMaterial::terminate(FEngine& engine) {
388388
<< "destroying material \"" << this->getName().c_str_safe() << "\" but "
389389
<< pos->second.size() << " instances still alive.";
390390
} else {
391-
utils::slog.e << "destroying material \"" << this->getName().c_str_safe() << "\" but "
392-
<< pos->second.size() << " instances still alive.";
391+
if (UTILS_UNLIKELY(!pos->second.empty())) {
392+
slog.e << "destroying material \"" << this->getName().c_str_safe() << "\" but "
393+
<< pos->second.size() << " instances still alive." << io::endl;
394+
}
393395
}
394396
}
395397

396-
397398
#if FILAMENT_ENABLE_MATDBG
398399
// Unregister the material with matdbg.
399400
matdbg::DebugServer* server = engine.debug.server;

0 commit comments

Comments
 (0)