一部の状況下において、モバイルレンダラで ReflectionCapture によるクラッシュが発生します

お世話になっております。

一部の状況下において、モバイルレンダラで ReflectionCapture によるクラッシュが発生します。

iOS / Android の実機パッケージ、およびエディタのスタンドアロンゲームモバイルにて確認しています。

レベルへの遷移時に発生し、毎回発生するレベルもあれば、たまに発生するレベルも存在します。

以下、弊社にて調査いたしました。

クラッシュは UReflectionCaptureComponent::EncodedHDRCubemapTexture の RHI リソース生成時に発生し、元となる FReflectionCaptureData の内容が不正であることが原因のようです。

FReflectionCaptureData の内容が不正になる過程は以下のような流れでした。

1. 該当の ReflectionCapture データに対し、FReflectionCaptureData::OnDataUploadedToGPUFinal() が呼ばれ、!GIsEditor の時にメンバがクリアされます。​

2. その後、該当の ReflectionCapture アクターの EncodedHDRCubemapTexture に対し、FReflectionTextureCubeResource::InitResource() が呼ばれます。

しかし、このタイミングでは元となる FReflectionCaptureData のメンバは既にクリアされており、内容が不正になり、クラッシュが発生します。

クラッシュがまったく発生しないレベルにて確認したところ、1. の処理の前に 2. の処理が行われておりました。

こちらの処理が順不同になっていることが原因かと考えております。

再現プロジェクトが提出できず恐縮なのですが、ご確認頂けませんでしょうか。

※ 弊社はカスタムエンジンを使用しており、それがトリガーを引いている可能性もございます。​

また、既にご対応済みである場合は、コミットをご教示いただけますと幸いです。

以上、よろしくお願いいたします。​

[Attachment Removed]

1. FReflectionCaptureData::OnDataUploadedToGPUFinal() が呼ばれるまでのコールスタックは以下の通りです:

RenderThread 0 (36)
#0	 in UE::Core::Private::Function::TFunctionRefCaller<FScene::CaptureOrUploadReflectionCapture(UReflectionCaptureComponent*, int, bool, bool, bool)::$_0, void, FRHICommandListImmediate&>::Call [inlined] at Engine/Source/Runtime/Engine/Classes/Engine/MapBuildDataRegistry.h:221
#1	 in UE::Core::Private::Function::TFunctionRefCaller<FScene::CaptureOrUploadReflectionCapture(UReflectionCaptureComponent*, int, bool, bool, bool)::$_0, void, FRHICommandListImmediate&>::Call [inlined] at Engine/Source/Runtime/Renderer/Private/ReflectionEnvironmentCapture.cpp:1468
#2	 in UE::Core::Private::Function::TFunctionRefCaller<FScene::CaptureOrUploadReflectionCapture(UReflectionCaptureComponent*, int, bool, bool, bool)::$_0, void, FRHICommandListImmediate&>::Call [inlined] at Engine/Source/Runtime/Core/Public/Templates/Invoke.h:47
#3	 in UE::Core::Private::Function::TFunctionRefCaller<FScene::CaptureOrUploadReflectionCapture(UReflectionCaptureComponent*, int, bool, bool, bool)::$_0, void, FRHICommandListImmediate&>::Call at Engine/Source/Runtime/Core/Public/Templates/Function.h:292
#4	 in FRenderThreadCommandPipe::TRenderCommandTask<TUniqueFunction<void (FRHICommandListImmediate&)>>::DoTask [inlined] at Engine/Source/Runtime/Core/Public/Templates/Function.h:414
#5	 in FRenderThreadCommandPipe::TRenderCommandTask<TUniqueFunction<void (FRHICommandListImmediate&)>>::DoTask at Engine/Source/Runtime/RenderCore/Public/RenderingThread.h:563
#6	 in TGraphTask<FRenderThreadCommandPipe::TRenderCommandTask<TUniqueFunction<void (FRHICommandListImmediate&)>>>::ExecuteTask at Engine/Source/Runtime/Core/Public/Async/TaskGraphInterfaces.h:696
#7	 in UE::Tasks::Private::FTaskBase::TryExecuteTask at Engine/Source/Runtime/Core/Public/Tasks/TaskPrivate.h:518
#8	 in FNamedTaskThread::ProcessTasksNamedThread [inlined] at Engine/Source/Runtime/Core/Public/Async/TaskGraphInterfaces.h:495
#9	 in FNamedTaskThread::ProcessTasksNamedThread at Engine/Source/Runtime/Core/Private/Async/TaskGraph.cpp:791
#10	 in FNamedTaskThread::ProcessTasksUntilQuit at Engine/Source/Runtime/Core/Private/Async/TaskGraph.cpp:679
#11	 in RenderingThreadMain at Engine/Source/Runtime/RenderCore/Private/RenderingThread.cpp:260
#12	 in FRenderingThread::Run at Engine/Source/Runtime/RenderCore/Private/RenderingThread.cpp:418
#13	 in FRunnableThreadPThread::Run at Engine/Source/Runtime/Core/Private/HAL/PThreadRunnableThread.cpp:25
#14	 in FRunnableThreadPThread::_ThreadProc at Engine/Source/Runtime/Core/Private/HAL/PThreadRunnableThread.h:187
#15	 in _pthread_start ()

2. FReflectionTextureCubeResource::InitResource() が呼ばれるまでのコールスタックは以下の通りです:

Thread 13
#0	 in UReflectionCaptureComponent::OnRegister [inlined] at Engine/Source/Runtime/Engine/Private/Components/ReflectionCaptureComponent.cpp:585
#1	 in UReflectionCaptureComponent::OnRegister at Engine/Source/Runtime/Engine/Private/Components/ReflectionCaptureComponent.cpp:789
#2	 in UActorComponent::ExecuteRegisterEvents at Engine/Source/Runtime/Engine/Private/Components/ActorComponent.cpp:2458
#3	 in UActorComponent::RegisterComponentWithWorld at Engine/Source/Runtime/Engine/Private/Components/ActorComponent.cpp:1989
#4	 in AActor::IncrementalRegisterComponents at Engine/Source/Runtime/Engine/Private/Actor.cpp:6156
#5	 in ULevel::IncrementalRegisterComponents at Engine/Source/Runtime/Engine/Private/Level.cpp:2000
#6	 in ULevel::IncrementalUpdateComponents at Engine/Source/Runtime/Engine/Private/Level.cpp:1878
#7	 in UWorld::AddToWorld at Engine/Source/Runtime/Engine/Private/World.cpp:3791
#8	 in ULevelStreaming::UpdateStreamingState at Engine/Source/Runtime/Engine/Private/LevelStreaming.cpp:1057
#9	 in UWorld::UpdateLevelStreaming [inlined] at Engine/Source/Runtime/Engine/Classes/Engine/LevelStreaming.h:808
#10	 in UWorld::UpdateLevelStreaming at Engine/Source/Runtime/Engine/Private/World.cpp:5043
#11	 in UGameViewportClient::Draw at Engine/Source/Runtime/Engine/Private/GameViewportClient.cpp:1844
#12	 in FViewport::Draw at Engine/Source/Runtime/Engine/Private/UnrealClient.cpp:1796
#13	 in UGameEngine::RedrawViewports at Engine/Source/Runtime/Engine/Private/GameEngine.cpp:789
#14	 in UGameEngine::Tick at Engine/Source/Runtime/Engine/Private/GameEngine.cpp:2006
#15	 in FEngineLoop::Tick at Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp:5828
#16	 in FAppEntry::Tick at Engine/Source/Runtime/Launch/Private/IOS/LaunchIOS.cpp:568
#17	 in -[IOSAppDelegate MainAppThread:] at Engine/Source/Runtime/ApplicationCore/Private/IOS/IOSAppDelegate.cpp:491
#18	 in __NSThread__start__ ()
#19	 in _pthread_start ()

[Attachment Removed]

クラッシュ時のコールスタックは以下の通りです:

RenderThread 0 (37)
#0	 in __pthread_kill ()
#1	 in pthread_kill ()
#2	 in abort ()
#3	 in __assert_rtn ()
#4	 in MTLReportFailure.cold.1 ()
#5	 in MTLReportFailure ()
#6	 in _MTLMessageContextEnd ()
#7	 in -[MTLTextureDescriptorInternal validateWithDevice:] ()
#8	 in -[AGXG17FamilyDevice heapTextureSizeAndAlignWithDescriptor:] ()
#9	 in -[CaptureMTLDevice heapTextureSizeAndAlignWithDescriptor:] ()
#10	 in FMetalResourceHeap::CreateTexture [inlined] at Engine/Source/ThirdParty/MetalCPP/Foundation/NSObject.hpp:216
#11	 in FMetalResourceHeap::CreateTexture [inlined] at Engine/Source/ThirdParty/MetalCPP/Metal/MTLDevice.hpp:907
#12	 in FMetalResourceHeap::CreateTexture ()
#13	 in FMetalDevice::CreateTexture at Engine/Source/Runtime/Apple/MetalRHI/Private/MetalDevice.cpp:599
#14	 in FMetalSurface::FMetalSurface at Engine/Source/Runtime/Apple/MetalRHI/Private/MetalTexture.cpp:645
#15	 in FMetalDynamicRHI::RHICreateTextureInitializer [inlined] at Engine/Source/Runtime/Apple/MetalRHI/Private/MetalTexture.cpp:548
#16	 in FMetalDynamicRHI::RHICreateTextureInitializer at Engine/Source/Runtime/Apple/MetalRHI/Private/MetalTexture.cpp:1520
#17	 in FRHICommandListBase::CreateTextureInitializer at Engine/Source/Runtime/RHI/Public/RHICommandList.h:935
#18	 in FReflectionTextureCubeResource::InitRHI [inlined] at Engine/Source/Runtime/RHI/Public/RHICommandList.h:943
#19	 in FReflectionTextureCubeResource::InitRHI at Engine/Source/Runtime/Engine/Private/Components/ReflectionCaptureComponent.cpp:598
#20	 in FRenderResource::InitResource at Engine/Source/Runtime/RenderCore/Private/RenderResource.cpp:198
#21	 in TGraphTask<FRenderThreadCommandPipe::TRenderCommandTask<void FRenderCommandDispatcher::Enqueue<TRenderCommandTag<BeginInitResource(FRenderResource*, FRenderCommandPipe*)::TSTR_InitCommand295>>(FRenderCommandPipe*, TUniqueFunction<void (FRHICommandList&)>&&)::'lambda'(FRHICommandListImmediate&)>>::ExecuteTask [inlined] at Engine/Source/Runtime/Core/Public/Templates/Function.h:414
#22	 in TGraphTask<FRenderThreadCommandPipe::TRenderCommandTask<void FRenderCommandDispatcher::Enqueue<TRenderCommandTag<BeginInitResource(FRenderResource*, FRenderCommandPipe*)::TSTR_InitCommand295>>(FRenderCommandPipe*, TUniqueFunction<void (FRHICommandList&)>&&)::'lambda'(FRHICommandListImmediate&)>>::ExecuteTask [inlined] at Engine/Source/Runtime/RenderCore/Public/RenderingThread.h:1110
#23	 in TGraphTask<FRenderThreadCommandPipe::TRenderCommandTask<void FRenderCommandDispatcher::Enqueue<TRenderCommandTag<BeginInitResource(FRenderResource*, FRenderCommandPipe*)::TSTR_InitCommand295>>(FRenderCommandPipe*, TUniqueFunction<void (FRHICommandList&)>&&)::'lambda'(FRHICommandListImmediate&)>>::ExecuteTask [inlined] at Engine/Source/Runtime/RenderCore/Public/RenderingThread.h:563
#24	 in TGraphTask<FRenderThreadCommandPipe::TRenderCommandTask<void FRenderCommandDispatcher::Enqueue<TRenderCommandTag<BeginInitResource(FRenderResource*, FRenderCommandPipe*)::TSTR_InitCommand295>>(FRenderCommandPipe*, TUniqueFunction<void (FRHICommandList&)>&&)::'lambda'(FRHICommandListImmediate&)>>::ExecuteTask at Engine/Source/Runtime/Core/Public/Async/TaskGraphInterfaces.h:696
#25	 in UE::Tasks::Private::FTaskBase::TryExecuteTask at Engine/Source/Runtime/Core/Public/Tasks/TaskPrivate.h:518
#26	 in FNamedTaskThread::ProcessTasksNamedThread [inlined] at Engine/Source/Runtime/Core/Public/Async/TaskGraphInterfaces.h:495
#27	 in FNamedTaskThread::ProcessTasksNamedThread at Engine/Source/Runtime/Core/Private/Async/TaskGraph.cpp:791
#28	 in FNamedTaskThread::ProcessTasksUntilQuit at Engine/Source/Runtime/Core/Private/Async/TaskGraph.cpp:679
#29	 in RenderingThreadMain at Engine/Source/Runtime/RenderCore/Private/RenderingThread.cpp:260
#30	 in FRenderingThread::Run at Engine/Source/Runtime/RenderCore/Private/RenderingThread.cpp:418
#31	 in FRunnableThreadPThread::Run at Engine/Source/Runtime/Core/Private/HAL/PThreadRunnableThread.cpp:25
#32	 in FRunnableThreadPThread::_ThreadProc at Engine/Source/Runtime/Core/Private/HAL/PThreadRunnableThread.h:187
#33	 in _pthread_start ()

なお、クラッシュ前に以下のアサートが発生します。

>check(CreateDesc.Extent.X > 0 && CreateDesc.Extent.Y > 0 && CreateDesc.NumMips > 0);

RenderThread 0 (35)
#0	 in FMetalSurface::FMetalSurface at Engine/Source/Runtime/Apple/MetalRHI/Private/MetalTexture.cpp:549
#1	 in FMetalDynamicRHI::RHICreateTextureInitializer [inlined] at Engine/Source/Runtime/Apple/MetalRHI/Private/MetalTexture.cpp:548
#2	 in FMetalDynamicRHI::RHICreateTextureInitializer at Engine/Source/Runtime/Apple/MetalRHI/Private/MetalTexture.cpp:1520
#3	 in FRHICommandListBase::CreateTextureInitializer at Engine/Source/Runtime/RHI/Public/RHICommandList.h:935
#4	 in FReflectionTextureCubeResource::InitRHI [inlined] at Engine/Source/Runtime/RHI/Public/RHICommandList.h:943
#5	 in FReflectionTextureCubeResource::InitRHI at Engine/Source/Runtime/Engine/Private/Components/ReflectionCaptureComponent.cpp:598
#6	 in FRenderResource::InitResource at Engine/Source/Runtime/RenderCore/Private/RenderResource.cpp:198
#7	 in TGraphTask<FRenderThreadCommandPipe::TRenderCommandTask<void FRenderCommandDispatcher::Enqueue<TRenderCommandTag<BeginInitResource(FRenderResource*, FRenderCommandPipe*)::TSTR_InitCommand295>>(FRenderCommandPipe*, TUniqueFunction<void (FRHICommandList&)>&&)::'lambda'(FRHICommandListImmediate&)>>::ExecuteTask [inlined] at Engine/Source/Runtime/Core/Public/Templates/Function.h:414
#8	 in TGraphTask<FRenderThreadCommandPipe::TRenderCommandTask<void FRenderCommandDispatcher::Enqueue<TRenderCommandTag<BeginInitResource(FRenderResource*, FRenderCommandPipe*)::TSTR_InitCommand295>>(FRenderCommandPipe*, TUniqueFunction<void (FRHICommandList&)>&&)::'lambda'(FRHICommandListImmediate&)>>::ExecuteTask [inlined] at Engine/Source/Runtime/RenderCore/Public/RenderingThread.h:1110
#9	 in TGraphTask<FRenderThreadCommandPipe::TRenderCommandTask<void FRenderCommandDispatcher::Enqueue<TRenderCommandTag<BeginInitResource(FRenderResource*, FRenderCommandPipe*)::TSTR_InitCommand295>>(FRenderCommandPipe*, TUniqueFunction<void (FRHICommandList&)>&&)::'lambda'(FRHICommandListImmediate&)>>::ExecuteTask [inlined] at Engine/Source/Runtime/RenderCore/Public/RenderingThread.h:563
#10	 in TGraphTask<FRenderThreadCommandPipe::TRenderCommandTask<void FRenderCommandDispatcher::Enqueue<TRenderCommandTag<BeginInitResource(FRenderResource*, FRenderCommandPipe*)::TSTR_InitCommand295>>(FRenderCommandPipe*, TUniqueFunction<void (FRHICommandList&)>&&)::'lambda'(FRHICommandListImmediate&)>>::ExecuteTask at Engine/Source/Runtime/Core/Public/Async/TaskGraphInterfaces.h:696
#11	 in UE::Tasks::Private::FTaskBase::TryExecuteTask at Engine/Source/Runtime/Core/Public/Tasks/TaskPrivate.h:518
#12	 in FNamedTaskThread::ProcessTasksNamedThread [inlined] at Engine/Source/Runtime/Core/Public/Async/TaskGraphInterfaces.h:495
#13	 in FNamedTaskThread::ProcessTasksNamedThread at Engine/Source/Runtime/Core/Private/Async/TaskGraph.cpp:791
#14	 in FNamedTaskThread::ProcessTasksUntilQuit at Engine/Source/Runtime/Core/Private/Async/TaskGraph.cpp:679
#15	 in RenderingThreadMain at Engine/Source/Runtime/RenderCore/Private/RenderingThread.cpp:260
#16	 in FRenderingThread::Run at Engine/Source/Runtime/RenderCore/Private/RenderingThread.cpp:418
#17	 in FRunnableThreadPThread::Run at Engine/Source/Runtime/Core/Private/HAL/PThreadRunnableThread.cpp:25
#18	 in FRunnableThreadPThread::_ThreadProc at Engine/Source/Runtime/Core/Private/HAL/PThreadRunnableThread.h:187
#19	 in _pthread_start ()

[Attachment Removed]

お世話になっております。

本件確認させて頂いたところ弊社内でも類似の競合問題を確認しており、ワークアラウンドとしてCL49645640の対応が行われておりました。

こちら上記修正の他に、r.TossReflectionCaptureDataOnGT=1 設定をINIファイルに追加することで対応可能となっております。

ご不便をおかけしますが、上記修正、及び設定の追加をお試し頂けますと幸いです。

よろしくお願いいたします。

[Attachment Removed]

お世話になっております。

ご返信ありがとうございます。

ご案内頂いた CL の変更を反映し、問題が解消されることを確認いたしました。

補足ではございますが、​r.TossReflectionCaptureDataOnGT の設定についてはご案内頂いた CL で削除されており、既存のコードにも存在しないようでしたので、追加しておりません。

本件は解決で問題ございません。

この度はご対応ありがとうございました。​

[Attachment Removed]

ご確認頂きありがとうございます。

​ご指摘頂いた設定項目に関しては削除されて対応が行われておりました。こちらの確認不足となり申し訳ございません。

本件はクローズとさせて頂きますが、また何かございましたらお気軽にご相談頂ければと思います。

よろしくお願いいたします。​

[Attachment Removed]