RHI flush resources costly

I am optimizing a scene in my game, and I’m currently getting stuck on my rendering thread. I am seeing large costs appearing in the FRDGBuilder, specifically EndFlushResourcesRHI, which sometimes spikes up to 11-14ms for a few frames.

What would be the reason for such a high amount of resources flushing? Is there a way to profile further? or is there an overarching reason for this?

2 Likes

Did you happen to ever figure out the issue? I am currently very stuck on this problem myself. Pretty much the same exact thing.

I am also having this issue, since 5.3. Sometimes EndFlushResources will take less than 0.5 ms, other times it will take 5ms and remain that way for the duration of the game. The only thing I found during testing to reliably trigger it is executing more than 1 task on the task graph from the game thread.

Here’s a picture of my profiling and annotations.

I’ve seen some other plausible explanations such as losing and regaining window focus and vsync/other sync configurations-- though I have not found any success looking into these.

Very interested in this problem. I am optimizing my game and started having this issue with large EndFlushResourcesRHI times like two days ago. I get up to 20ms for this which drops fps down to like 30. Didn’t dig deep yet but figured out that it appears in every dev-build. Packaged for shipping is just fine. It’s almost impossible to continue work like this.

Did anyone figure this out yet?

(Working on UE 5.4.4)

okay, after days of frustration I figured it out. I started to inspect every warning in the Output Log and tried to get rid of it. One warning was: “LogD3D12RHI: Warning: Failed to query NVIDIA driver version”.
I then searched in source code to find the code and reproduced the call to NvAPI_SYS_GetDriverAndBranchVersion(&DriverVersion, BranchString); and found that the return value was NVAPI_NO_IMPLEMENTATION which sounded strange. I googled a bit and found something connected to RenderDoc (totally different problem) and I remembered that I had installed RenderDoc-Plugin a few days ago to investigate some rendering stuff. Uninstalling RenderDoc solved it for me, yay.