Hi,
These cook errors happen roughly 1/5 times and prevent the cook from completing successfuly.
Assertion failed: TextureReferenceIndex != INDEX_NONE [File:…\Engine\Source\Runtime\Engine\Private\Materials\HLSLMaterialTranslator.cpp]
Similar to this editor issue: [Content removed]
Also already being tracked by Epic here: https://issues.unrealengine.com/issue/UE\-318809
The cooks fail on the exact same Material asset each time this occurs.
So far we have tried to:
* Resaving the asset, but this did not help.
* We observed that UMaterial::UpdateCachedExpressionData is indeed called prior to this happening.
* We’ve started tracking DDC Key files for this material during cooks with : r.ShaderCompiler.DebugDDCKeyAsset=MyProblematicMaterialAssetName
* On failed cooks we noticed that DDC Key file was missing 2 entries related to some code in FMaterialShaderMapId::RecordAndEmit:
\- ReferencedFunctions
\- ReferencedParameterCollections
Since ReferencedFunctions and ReferencedParameterCollections are not written to the DDC keygen hash, the cook looks for an invalid hash key for that material’s DDC data.
Our current theory is that some of the Material’s dependencies (Expressions, textures parameters) are not yet fully loaded in when HLSLMaterialTranslator is called.
This prevents ReferencedFunctions and ReferencedParameterCollections from being populated prior to HLSLMaterialTranslator.
Is there a simple way to make sure UMaterial’s dependencies are loaded before it gets translated during the cook?
Would this make sense?
------------------------------------------ CODE------------------------------------------
UMaterial::UpdateCachedExpressionData()
//@note FH: temporary preemptive PostLoad until zenloader load ordering improvements
ConditionalPostLoad();
////////////////////////START/////////////////////////////////////////
for (UMaterialExpression* Expression : GetExpressions())
{
if (Expression)
{
Expression->ConditionalPostLoad();
}
}
////////////////////////END/////////////////////////////////////////
…
------------------------------------------ CODE------------------------------------------
Thanks,
David
[Attachment Removed]