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.