Description

While working with DirectX 12 in the project settings, the editor crashes by check() code when attempting to create a static texture from a non-HDR Cube Render Target asset. This crash doesn't occur with DirectX 11.
 
The check() code in question is in FD3D12DynamicRHI::GetStagingTexture()  in D3D12RenderTarget.cpp.
 
 

// Ensure we're dealing with a Texture2D, which the rest of this function already assumes
check(TextureRHI->GetTexture2D());

 
 
Possible Solution:
Further down in this function, there's code that handles a texture as a Cube Map. Therefore, this check code could be unnecessary (It seems DX11 doesn't do this kind of check.) Commenting out this line makes it possible to create a valid texture asset from a non-HDR Cube Render Target asset.

Steps to Reproduce
  1. Change the project settings under Platforms - Windows > Targeted RHIs > Default RHI to "DirectX 12".
  2. Add a Cube Render Target in the content browser.
  3. Open the created Cube Render Target and untick the HDR property.
  4. Place a Scene Capture Cube in the level and set the Capture Source property to a non-HDR option (e.g., "Final Color (LDR) in RGB").
  5. Assign the Cube Render Target created above to the Texture Target property of the Scene Capture Cube.
  6. Right-click on the Cube Render Target in the content browser and select "Create Static Texture". This is where the crash occurs.

The attached project to repro already finished step 1 to 5.

Callstack

(This callstack came from UE5.2.1)

LoginId:637e5626447de5b7d4b9e9a79f04a92e
EpicAccountId:e08a7c8293b5475087681986ffe111c2

Assertion failed: TextureRHI->GetTexture2D() [Link Removed] [Line: 653]

UnrealEditor_D3D12RHI!FD3D12DynamicRHI::GetStagingTexture() [D:\build\++UE5\Sync\Engine\Source\Runtime\D3D12RHI\Private\D3D12RenderTarget.cpp:653]
UnrealEditor_D3D12RHI!FD3D12DynamicRHI::ReadSurfaceDataNoMSAARaw() [D:\build\++UE5\Sync\Engine\Source\Runtime\D3D12RHI\Private\D3D12RenderTarget.cpp:759]
UnrealEditor_D3D12RHI!FD3D12DynamicRHI::RHIReadSurfaceData() [D:\build\++UE5\Sync\Engine\Source\Runtime\D3D12RHI\Private\D3D12RenderTarget.cpp:1232]
UnrealEditor_RHI!FRHICommandListImmediate::ReadSurfaceData() [D:\build\++UE5\Sync\Engine\Source\Runtime\RHI\Public\RHICommandList.h:4770]
UnrealEditor_Engine!TEnqueueUniqueRenderCommandType<`FTextureRenderTargetCubeResource::ReadPixels'::`2'::ReadSurfaceCommandName,<lambda_4bdfc41ec1076a6d75cd6e5ae57c4443> >::DoTask() [D:\build\++UE5\Sync\Engine\Source\Runtime\RenderCore\Public\RenderingThread.h:209]
UnrealEditor_Engine!TGraphTask<TEnqueueUniqueRenderCommandType<`FTextureRenderTargetCubeResource::ReadPixels'::`2'::ReadSurfaceCommandName,<lambda_4bdfc41ec1076a6d75cd6e5ae57c4443> > >::ExecuteTask() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h:1310]
UnrealEditor_Core!FNamedTaskThread::ProcessTasksNamedThread() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:758]
UnrealEditor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:649]
UnrealEditor_RenderCore!RenderingThreadMain() [D:\build\++UE5\Sync\Engine\Source\Runtime\RenderCore\Private\RenderingThread.cpp:416]
UnrealEditor_RenderCore!FRenderingThread::Run() [D:\build\++UE5\Sync\Engine\Source\Runtime\RenderCore\Private\RenderingThread.cpp:542]
UnrealEditor_Core!FRunnableThreadWin::Run() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Windows\WindowsRunnableThread.cpp:149]

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-195025 in the post.

1
Login to Vote

Fixed
ComponentUE - Rendering Architecture - RHI
Affects Versions5.15.25.3
Target Fix5.5
Fix Commit28494190
CreatedSep 11, 2023
ResolvedSep 13, 2024
UpdatedSep 18, 2024
View Jira Issue