Skip to content

Add defines to strip unused default materials #8723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

z3moon
Copy link
Contributor

@z3moon z3moon commented May 12, 2025

Add defines for trimming default materials. These enable binary size reduction by omitting them. Referencing the trimmed material will cause associated renderables to be skipped from rendering.

BUG=[415840223]

Add defines for trimming default materials. These enable binary size
reduction by omitting them. Referencing the trimmed material will cause
associated renderables to be skipped from rendering.

BUG=[415840223]
@z3moon z3moon added the internal Issue/PR does not affect clients label May 12, 2025
@@ -468,12 +468,16 @@ RenderableManager::Builder::Result RenderableManager::Builder::build(Engine& eng
auto& entry = mImpl->mEntries[i];

// entry.materialInstance must be set to something even if indices/vertices are null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still valid? If FILAMENT_TRIM_DEFAULT_MATERIAL is set then entry.materialInstance could end up null. Will that cause a crash later on?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this will be handled in FRenderPrimitive::init in filament/src/RenderPrimitive.cpp. (above)

But the comment needs to be updated accordingly.

@z3moon z3moon marked this pull request as draft July 10, 2025 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Issue/PR does not affect clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants