Crash when Nanite + Client + NullRHI

I have made my own fix for this, but there are other ways it could be addressed:

  • Modify `RHIExit()` in DynamicRHI.cpp so that `GDynamicRHI->Shutdown() and delete` is still called when using null rhi. My reasoning is that if it is initialized for nullrhi then it should be deinitialized for it also.
  • Modify `FNullDynamicRHI::Shutdown()` to call `FRenderResource::ReleaseRHIForAllResources();` so it matches `FRenderResource::InitPreRHIResources();` call in `FNullDynamicRHI::Init()`

Steps to Reproduce
As per the attached example project (just run client with -nullrhi):

  1. New empty project
  2. Enable DX12 SM6 for Nanite support
  3. Ensure the client will exit itself, e.g.
    1. Select the `(project name)GameModeBase` as the default game mode
    2. Override `BeginPlay`
    3. Add `FPlatformMisc::RequestExitWithStatus(false, 0);` to `BeginPlay`
  4. Run client with `-nullrhi` command line argument
  5. Crash on exit will occur during static deinit of Nanite feedback system due to `GSystem` having already been destructed (i.e. static order of deinit bug).

Hello there,

I’ve replicated the issue, and this does indeed appear to be a bug.

I’ll file a bug report and reply with a tracking link when one becomes available.

Best regards,

Chris

Hi,

Please find the tracker live at Unreal Engine Issues and Bug Tracker (UE-266669). Thank you for bringing this to our attention.

Best regards,

Chris