FD3D12DescriptorCache::SetRootConstantBuffers crash when applying Decal material to Decal Actor

  1. Create a new Blank game project
  2. Add a Decal Actor to the level
  3. Create a new Material
  4. Set the Material Domain to “Deferred Decal” and Blend Mode to “TranslucentGrayTransmittance”
  5. Attach a Distance Cull Fade node to Opacity.
  6. Right click Roughness and Promote to Parameter.
  7. Save the material and set it on the Decal Actor. Crash occurs.
    UECC-Windows-FA47493F4957F381F1BF06A69A3847DA_0000.zip(594 KB)

Steps to Reproduce
We have discovered a crash when applying decal materials:

Fatal error: [File:D:\Projects\UEBA\+dev_UGS\Sync\Engine\Source\Runtime\D3D12RHI\Private\D3D12DescriptorCache.cpp] [Line: 730]

Missing uniform buffer at slot 2, stage SF_Pixel. Please check the high level drawing code. Hashes: Vertex: 0412344381A54356369561A7263987C92AFDE647, Pixel: D5D063E9FD40319BC8B11C12936A2BA8DE6CA44A, Pipeline: 63E75D898B7658DB70F261F2CB6E568C0F398DE0.

The crash is easily repro-able in unmodified UE 5.6.1 and 5.8.0 Preview. Repro steps for 5.8 are given below, and I have attached the crash files. We’d be interested to know if there is a fix.

Hello!

Thanks for letting us know about this crash. I’ve verified the problem still exists in latest and created the following issue for tracking: https://issues.unrealengine.com/issue/UE\-384624\. It should be visible publicly soon.

To fix the issue, you can:

  1. Remove the Distance Cull Fade node from the Material as it shouldn’t have an affect for Deferred Decals because they have their own fade logic on the Decal Actor.
  2. Modify GetDistanceCullFade() in MaterialTemplate.ush:1975 to ignore that buffer when IS_DECAL
  3. Mirror the mesh decal path in FDeferredDecalPS::SetParameters and bind the missing buffer to one that is always 1
auto& PrimitivePS = GetUniformBufferParameter<FPrimitiveUniformShaderParameters>();
SetUniformBufferParameter(BatchedParameters, PrimitivePS, GIdentityPrimitiveUniformBuffer);
 
// Decal materials can reference the DistanceCullFade node (GetDistanceCullFade -> PrimitiveFade UB),
// but the decal path doesn't run through FMeshMaterialShader which normally binds it. Bind the default
// fully-faded-in buffer so these materials don't crash (decals aren't per-primitive distance culled).
auto& FadePS = GetUniformBufferParameter<FDistanceCullFadeUniformShaderParameters>();
if (FadePS.IsBound())
{
    SetUniformBufferParameter(BatchedParameters, FadePS, GDistanceCullFadedInUniformBuffer.GetUniformBufferRHI());
}

We’ll probably go with #2 or #3.

What were you using the Decal Fade Node for in your Decal Materials?

Thanks for the suggested fixes! We have the Distance Cull Fade as part of a material function to do fading for ordinary mesh materials and I’m not sure we actually need it for decals. Also, once this is fixed, it would be nice to have a warning to say this node isn’t compatible with Decal materials when someone tries to use it.