This change implements a caching mechanism for material translation results. After translating a material, the intermediate results are now stored in the DDC (Derived Data Cache) for future retrieval. When the material translator is requested to translate a material, it first checks the DDC to see if th combination of specified base material, parameter sets, and platform-specific data is already present in the cache. If this key is found, the intermediate results are pulled and returned, avoiding expensive material translation and decoupling material translation from material shader generation.
The significant advantage of this change is that modifications to the material template source file or any dependent shader file no longer trigger a material retranslation. The material shader can still be generated correctly, using the cached translation results, which ensures that material string generation always uses up-to-date input files.
#jira UE-167483
#rb Jason.Nadro
[CL 29816298 by massimo tristano in ue5-main branch]
Cleaned up and made more rendering read-only cvars go through this cache
It now can cache platform specific cvars, in non-editor builds
#rb jack.porter
[CL 29681907 by dmitriy dyomin in ue5-main branch]
- Make various vertex factories work with the new translator
- Fix EnableNewHLSLTranslator check box not showing up when material domain is UI
- Implemented GenerateHLSLExpression for ObjectLocalBounds
- Fix per instance random/custom data not working for some material instances
- Update material function calls before generating a HLSL tree. This is needed to avoid mismatch of inputs/outputs between function calls and the material functions
- Fix SubsurfaceColor having the incorrect default value for two-sided foliage materials
- ShadingModel material property is now prepared before other properties. This is needed because some other properties depend on shading models. For example, SubsurfaceColor has a different default value for two-sided foliages
- For MP_ShadingModel, falls back to the first mateiral shading model if per pixel shading model is not allowed
- Added some error checkings that are present in the old translator but not in the new one
- Fix dynamic parameter and per instance custom data not working with the new translator
- Fix a bug with user vertex interpolators when the new translator is used. The bug is, when there are multiple material graph paths that use the same vertex interpolator and the component usages are different in those paths, the last component usage will override all previous usages causing some components being discarded because the translator think they are not used
- Component swizzling on a numeric scalar now replicates the scalar to YZW instead of returning zeros. This is also the behavior in the old translator
[FYI] tom.holmes, Danny.Kabrane, massimo.tristano, Jason.Nadro
[CL 29098392 by jian ru in ue5-main branch]
There were two issues:
* The material function preview was not correctly converting material attribute output.
* The cached expression were not populated, causing the IsMaterialAttributeOutput() function to not return the correct value.
Down the line, this was causing material attribute data to be connected to a float3 input causing a crash down the line.
#rb none
[FYI] sebastien.hillaire, massimo.tristano
[CL 28180761 by charles derousiers in ue5-main branch]
- Warning_CompileErrorsInMaterial was used twice for two different error messages.
- Renamed the second one to Warning_CompileErrorsInMaterialInstance, since it was an error message specific to material instances.
#rb Jon.Cain
#jira UE-195762
[CL 28033767 by jason nadro in ue5-main branch]