D3D12Commands.cpp 0xFFFF access crash in ValidateBoundUniformBuffer()

We have been running into this issue for a few months at least running UE 5.6. Our VFX Artists tend to run into this the most when running validation on changelists that contain materials with MPC references.

I see that in later versions of Unreal, in the D3D12 commands file, Uniform Buffer Parameter binding has moved to being a bindless parameter. In the code pathway through `SetShaderParametersOnContext()` bindless parameters are skipped if the `FRHIResource*` is nullptr, but normal resource parameters do not. Because we are accessing 0xFFFF in the validate function and not a nullptr I’m not sure that this is specifically the issue, but we are going to see if skipping null resources causes this to stop happening.

It’s very difficult to repro this issue since it is inconsistent, and feels like an ordering issue somewhere else, maybe with object destruction, that is only surfacing all the way down to the RHI command level.

[Attachment Removed]

Steps to Reproduce
Run Asset Validation on a changelist that contains materials, seemingly materials that have MPC references.

Usually happens to our VFX Artists after hours of having a single editor instance running.

[Attachment Removed]

Hello,

Apologies for the delay. If you’re still encountering this issue, we did recently submit a fix for a possibly related MPC crash that may address this issue:

UE6 CL#56207586 (00616f) Material Parameter Collections now use persistent shared uniform buffers for a given ID, rather than a uniform buffer per collection instance. Solves crashes when the same collection appears in multiple packages, and one or more of the packages gets unloaded, leading to stale uniform buffer references in cached mesh draw commands. Also fixed bug where material editor tile preview expression materials didn’t automatically refresh on collection layout edits (caused a stale ID crash). To make other missing refreshes not fatally crash the editor (none are known at this time, but it’s possible something besides tile preview was missed), a fallback dummy buffer is returned on a missing StateId in the editor.

It doesn’t really relate to bindless, so if that doesn’t address the issue and it’s still occurring we can take a closer look.

[Attachment Removed]