RTXGI Unreal Plugin asserts in Debug builds

We’ve just tried testing the RTXGI UE4 Plugin v1.1.42 against the latest release build of Unreal 4.27.2.

In a default Development Editor build, the plugin seemed to work well, however when we tried switching to a Debug Editor build to step through the code more carefully, the build immediately failed an assertion on level load. We were also able to reproduce this assertion by dragging a new RTXGI Volume actor into a clean level.

Assertion failed: NumMarks >= MinMarksToAlloc [File:C:\Dev\UnrealEngine-4.27.2-release\Engine\Source\Runtime\Core\Public\Misc/MemStack.h] [Line: 108] 

It seems to be related to the construction of an FRDGBuilder/Allocator on the Render Thread - from further investigation, it seems like these structures are usually constructed on the Main Thread. Is this assertion safe to ignore, or is there a more correct way to be constructing the FRDGBuilder?

Full call stack is as follows:

UE4Editor-RenderCore-Win64-Debug.dll!TMemStackAllocator<0>::ForElementType<FRDGAllocator::FTrackedAlloc *>::ResizeAllocation(int PreviousNumElements, int NumElements, unsigned __int64 NumBytesPerElement) Line 331
	at C:\Dev\UnrealEngine-4.27.2-release\Engine\Source\Runtime\Core\Public\Misc\MemStack.h(331)
UE4Editor-RenderCore-Win64-Debug.dll!TArray<FRDGAllocator::FTrackedAlloc *,TMemStackAllocator<0>>::ResizeTo(int NewMax) Line 2612
	at C:\Dev\UnrealEngine-4.27.2-release\Engine\Source\Runtime\Core\Public\Containers\Array.h(2612)
UE4Editor-RenderCore-Win64-Debug.dll!FRDGAllocator::FRDGAllocator() Line 216
	at C:\Dev\UnrealEngine-4.27.2-release\Engine\Source\Runtime\RenderCore\Public\RenderGraphDefinitions.h(216)
UE4Editor-RenderCore-Win64-Debug.dll!FRDGBuilder::FRDGBuilder(FRHICommandListImmediate & InRHICmdList, FRDGEventName InName, const char * UnaccountedCSVStat) Line 407
	at C:\Dev\UnrealEngine-4.27.2-release\Engine\Source\Runtime\RenderCore\Private\RenderGraphBuilder.cpp(407)
UE4Editor-RTXGI-Win64-Debug.dll!UDDGIVolumeComponent::UpdateRenderThreadData::__l5::<lambda>(FRHICommandListImmediate & RHICmdList) Line 1083
	at C:\Dev\RTXGI2\Plugins\RTXGI\Source\RTXGI\Private\DDGIVolumeComponent.cpp(1083)

After further investigation, this assert was fixed by adding the following line immediately before every FRDGBuilder construction call in DDGIVolumeComponent.cpp:

FMemMark Mark(FMemStack::Get());

This pushes a MemStack marker to the top of the memory stack for the duration of the enclosing scope, increasing NumMarks and therefore preventing the failed assertion.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.