Skip to content

Commit

Permalink
Add a warning for FRenderableManager (#8210)
Browse files Browse the repository at this point in the history
In some cases, users set materials first without providing render primitives, which has incurred the attribute mismatching warning. This isn't helpful because users don't know what action they should take to remove the warning.

Emit the warning only when the primitive handle is initialized so the AttributeBitset is properly populated.

BUGS=[372755205]
  • Loading branch information
z3moon authored Oct 20, 2024
1 parent 6e9afff commit 2456299
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion filament/src/components/RenderableManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,10 @@ void FRenderableManager::setMaterialInstanceAt(Instance instance, uint8_t level,
primitives[primitiveIndex].setMaterialInstance(mi);
AttributeBitset const required = material->getRequiredAttributes();
AttributeBitset const declared = primitives[primitiveIndex].getEnabledAttributes();
if (UTILS_UNLIKELY((declared & required) != required)) {
// Print the warning only when the handle is available. Otherwise this may end up
// emitting many invalid warnings as the `declared` bitset is not populated yet.
bool const isPrimitiveInitialized = !!primitives[primitiveIndex].getHwHandle();
if (UTILS_UNLIKELY(isPrimitiveInitialized && (declared & required) != required)) {
slog.w << "[instance=" << instance.asValue() << ", primitive @ " << primitiveIndex
<< "] missing required attributes ("
<< required << "), declared=" << declared << io::endl;
Expand Down

0 comments on commit 2456299

Please sign in to comment.