Assertion about CurrentDepthTexture in D3D11Comand.cpp, Unreal 4.18.3

I’m sorry if this question doesn’t quite fit this section, but I’m having trouble using the RHI API to call SetGraphicsPipelineState on the render thread in Unreal Engine 4.18.3.

Specifically, I’m setting the DepthStencilState like this:

GraphicsPSOInit.DepthStencilState = TStaticDepthStencilState<true, CF_Less>::GetRHI();

However, this triggers an assertion failure during project startup in ValidateExclusiveDepthStencilAccess inside D3D11Commands.cpp,at the line ensure(CurrentDepthTexture). If I change the true in the TStaticDepthStencilState to false, the assertion no longer occurs. So I suspect the issue is related to how CurrentDepthTexture is managed in my custom rendering flow.

My goal is to make this custom rendering process part of my CustomMeshComponent , so I’m enqueueing render commands inside the GetDynamicMeshElements function of my CustomSceneProxy using ENQUEUE_RENDER_COMMAND. However, I haven’t explicitly set up a render target.

Does anyone know how I should correctly structure this rendering process if I want the mesh to render in real time into the scene? And how should I properly configure the render target in this case?

Any insights or guidance would be greatly appreciated. Thanks in advance!