Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix performance regression with shadow mapping (bevyengine#7914)
# Objective - @mockersf identified a performance regression of about 25% longer frame times introduced by bevyengine#7784 in a complex scene with the Amazon Lumberyard bistro scene with both exterior and interior variants and a number of point lights with shadow mapping enabled - The additional time seemed to be spent in the `ShadowPassNode` - `ShadowPassNode` encodes the draw commands for the shadow phase. Roughly the same numbers of entities were having draw commands encoded, so something about the way they were being encoded had changed. - One thing that definitely changed was that the pipeline used will be different depending on the alpha mode, and the scene has lots entities with opaque and blend materials. This suggested that maybe the pipeline was changing a lot so I tried a quick hack to see if it was the problem. ## Solution - Sort the shadow phase items by their pipeline id - This groups phase items by their pipeline id, which significantly reduces pipeline rebinding required to the point that the performance regression was gone.
- Loading branch information