RenderPipeline Performace issue. Pstats shows "set state" consumes most time when there are many objects

Hi guys,

Could you take a look at this question? I wanna get some hints on optimizing my program when running with RenderPipeline. Thank you!


As described in the title, the FPS drops when there are a lot of objects in my scene (from 60 to 15). The results of FrameRateMeter prove this in the following two images.

The Pstat shows that “set state” occupies most time in one frame.
Screenshot from 2023-12-12 01-14-01

Besides, I am pretty sure that it is caused by RenderPipeline, as when I switch to another rendering pipeline, the FPS just goes back to 60 Hz in the same scene filling with many objects.


I checked the forum for related topics and suspect that it results from too many render state changes and shader input updates in each frame. By disabling some plugins, I found out that when PSSM and sky_ao are turned on, the number of state changes increases in each frame and the time spent on “set state” increases from 7ms to 20+ms. However, I have no idea about how this happens and how can I resolve it. Do you have any suggestions?