This seems only happens for those using the ULineBatchComponent。
To fix this as a workaround, two place:
Color Pass
Modify the PostProcessCompositeDebugPrimitives.cpp → DrawDebugPDE() →
GraphBuilder.AddPass(
RDG_EVENT_NAME("DrawDebugPrimitives(SDPG_World)"),
PassParameters,
ERDGPassFlags::Raster,
[PassParameters, DebugView=Context.DebugView, OutputViewport](FRDGAsyncTask, FRHICommandList& RHICmdList)
{
// Change this line to:
// RHICmdList.SetViewport(OutputViewport.Rect.Min.X, OutputViewport.Rect.Min.Y, 0.0f, OutputViewport.Rect.Max.X, OutputViewport.Rect.Max.Y, 1.0f);
RHICmdList.SetViewport(0.0f, 0.0f, 0.0f, OutputViewport.Rect.Width(), OutputViewport.Rect.Height(), 1.0f);
// ...
Depth Pass
Modify the Engine\Shaders\Private\PostProcessCompositePrimitives.usf → MainPopulateSceneDepthPS()
// Change this line to
// float2 ViewportUV = (SvPosition.xy - View.ViewRectMin.xy) * View.ViewSizeAndInvSize.zw;
float2 ViewportUV = (SvPosition.xy) * View.ViewSizeAndInvSize.zw;
This should be works fine now. The thing I didn’t get is the debug draw pass should be a post process and should be in the end of pipelines, which those passes assumes rendering to the middle of viewport. But it lies in the following catalog when I captured with Renderdoc. So I guess the entire bug is caused by mismatched RenderGraph dependency.