engine: encapsulate material cache handling#9663
Open
elizagamedev wants to merge 5 commits intomainfrom
Open
Conversation
pixelflinger
previously requested changes
Feb 2, 2026
Collaborator
pixelflinger
left a comment
There was a problem hiding this comment.
I'm not in love calling a ctor from a ctor passing "this". (i.e. FMaterial calling MaterialProgram(..., this)). I've been bit by this before.
d33979c to
537b630
Compare
537b630 to
e1ce482
Compare
poweifeng
reviewed
Feb 4, 2026
filament/src/MaterialPrograms.cpp
Outdated
| material.getMaterialParser(), mSpecializationConstants, material.isDefaultMaterial()); | ||
| } | ||
|
|
||
| void MaterialPrograms::initializeForMaterialInstance(FEngine& engine, FMaterial const& material) { |
Contributor
There was a problem hiding this comment.
I feel that we really just need one init function. And the call site can make that distinction between material vs material instance and pass in the appropriate params.
Contributor
Author
There was a problem hiding this comment.
I feel like the two different methods/names make it really clear why you would call one method vs the other. For example, using the same method obscures the meaning of passing in a FixedCapacityVector vs relying on what Material owns.
241a8dc to
40686bd
Compare
poweifeng
approved these changes
Feb 10, 2026
40686bd to
ec40649
Compare
We will soon allow `MaterialInstance` to override the value of spec constants. To avoid code duplication, we introduce a new class `MaterialPrograms` which handles the chunky bits of managing the program cache and values of the spec constants.
ec40649 to
83e7309
Compare
pixelflinger
approved these changes
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We will soon allow
MaterialInstanceto override the value of spec constants. To avoid code duplication, we introduce a new classMaterialProgramswhich handles the chunky bits of managing the program cache and values of the spec constants.